I'm converting my code from using Handler to AsyncTask. The latter is great at what is does - async updates and handling of results in the main UI thread. What's unclear to me is how to handle exceptions if something goes haywire in AsyncTask#doInBackground? The way I do it is to leave error Handler and send message to it. It works fine ...
I'm not having much luck with updating an app widget with AlarmManager generated broadcasts. Here's what I do:
Initializing AlarmManager on AppWidgetProvider#onEnabled
AlarmManager alarms = (AlarmManager) context.getSystemService(
Context.ALARM_SERVICE);
alarms.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemC...
So I'm working out my first multi-threaded application using Android with the AsyncTask class. I'm trying to use it to fire off a Geocoder in a second thread, then update the UI with onPostExecute, but I keep running into an issue with the proper Context.
I kind of hobbled my way through using Contexts on the main thread, but I'm not ex...
In order to get XML data from a server repeatedly, I'm attempting to use AsyncTask and Timer as per Mark Murphy's suggestion.
I get the following error:
01-07 16:11:26.705: ERROR/AndroidRuntime(729):
Caused by: java.lang.RuntimeException:
Can't create handler inside thread that has not
called Looper.prepare()
I'm using SDK 1.5 wit...
I've been working with AsyncTasks in Android and I am dealing with a strange issue.
Take a simple example, an Activity with one AsyncTask. The task on the background does not do anything spectacular, it just sleeps for 8 seconds.
At the end of the AsyncTask in the onPostExecute() method I am just setting a button visibility status to V...
For instance, we are in SomeActivity and the activity has a button that invokes moving files from one dir to another (let's call it job).
On BlackBerry I would:
push a non-cancellable popup (Dialog screen) saying "Please wait..."
start a thread that fulfills the job
on thread completion close the popup
This approach 99.99% can guara...
Can someone tell me the TRUE difference?
...
private class ExecuteLocations extends AsyncTask<String, Void, Void>{
private final ProgressDialog dialog = new ProgressDialog(ListProfiles.this);
protected void onPreExecute() {
//this.dialog.setMessage("Starting pre-execute...");
//this.dialog.show();
}
@Override
protected Void doInBackground(Strin...
Hi, is a good practice to have an Asynk task with a loop like this inside?
while (true) {
check queue and request API
Because i need to wait for my Activities and service needs to comunicate with the APi.
Thanks
...
According to this article
The Begin Event Handler is Always Invoked
The second impliciation of
AsyncTimeout that I had not really
internalized until recently is that
the begin event handler for a
registered async task is always
invoked, even if the page has timed
out before ASP.NET gets around to
starting that task...
Im using HTC Hero with HTS sense.
Im experience that sometimes AsyncTask not will run doInBackground method on execute();
Its only on my Hero this appears. Someone have come across same problem?
/ Martin
...
So I have a TimerTask task calling a function onTimerComplete() in its run()
onTimerComplete() looks something like this:
private void onTimerComplete(){
myFunc1();
myFunc2();
}
I make a Timer t and I schedule the TimerTask with t.schedule(task, 2000);
The problem is, when the timer is up and the task runs my onTimerComplete() b...
Basically I'm wondering how I'm able to do what I've written in the topic. I've looked through many tutorials on AsyncTask but I can't get it to work. I have a little form (EditText) that will take what the user inputs there and make it to a url query for the application to lookup and then display the results.
What I think would seem t...
I'm beginning to think that to get a ProgressDialog to work the AsyncTask has to be an inner class within an Activity class. True? [Edited much later...the answer is False and I'm not sure if this is a bug or what. I'm using Android 1.5. I'm going to read up on Services.]
I have an activity the uses a database to manipulate informati...
I am fetching lots of thumbnails from a remote server and displaying them in a grid view, using AsyncTask. The problem is, my grid view displays 20 thumbnails at a time, so that creates 20 AsyncTasks and starts 20 executes, one per thumbnail.
I get RejectedExecution exception in my code. I recall reading somewhere that there is a limit...
Hi all, I am running into an issue with the way my asynctasks are executed. Here's the problem code:
firstTask = new background().new FirstTask(context);
if(firstTask.execute().get().toString().equals("1"))
secondTask = new background().new SecondTask(context);
What I'm doing here is creating a new asynctask object, assignin...
Hi!
I'm having issues with BitmapFactory.decodeStream(inputStream). When using it without options, it will return an image. But when I use it with options as in .decodeStream(inputStream, null, options) it never returns Bitmaps.
What I'm trying to do is to downsample a Bitmap before I actually load it to save memory.
I've read some goo...
In my Activity I use multiple AsyncTask classes.
How to cancel AsyncTask when Activity finishes?
...
I read a lot on how to save my instance state or how to deal with my activity getting destroyed during screen rotation.
There seem to be a lot of possibilities but I haven't figured out which one works best for retrieving results of an AsyncTask.
I have some AsyncTasks that are simply started again and call the isFinishing() method of...
I'm looking for the most suitable class to be a dispatcher for AsyncTasks invoked from my Activities.
I think it could be one of these:
subclass of Application;
subclass of Service;
my own static stuff.
As for me - it's simlier to implement the 3rd choice. But the question is will it be more "death-resistant" than Service or Ap...