asynctask

Is AsyncTask really massively flawed or am I just missing something?

I have investigated this problem for months now, came up with different solutions to it, which I am not happy with since they are all massive hacks. I still cannot believe that a class that flawed in design made it into the framework and no-one is talking about it, so I guess I just must be missing something. The problem is with AsyncTa...

Android's AsyncTask issue

Hi, could anyone advise on the following: I'm trying to execute code from Android's help page, but it doesn't work for me: public class DownloadFilesTask extends AsyncTask<String, Integer, Long> { protected Long doInBackground(String... urls) { Log.e("TuneWiki", "Exec"); return 1l; } @Ove...

PageAsyncTask endHandler to update the calling page

I've been coerced into applying Microsoft's PageAsyncTask objects, which I am new to (before I've always used jQuery AJAX calls). I've got everything working just right except once the work is done and the endHandler is called, how do I have the calling page update its contents? Basically my async function runs a slew of database operat...

AsyncTask not displaying onPreExecute

I have two AsyncTask Activities, whose sole responsibilties are to execute an AsyncTask on the UI Thread. One of them works great, displays the progressBar, and updates the ProgressBar message. This is for my SearchActivity, which is actually a search activity with the Google Search metadata for declaring a search activity. I created a c...

How to use separate thread to perform http requests

I have an application that is performing HTTP Requests (specifically calling the FogBugz API) when the user clicks certain buttons. Right now, I am just creating a service when the application starts, and then calling different methods in that service to complete requests. However, when I do this, there is the usual hang in the UI thread...

optimizing bitmap loading by using aSyncTask.

I have been trying to optimize my single thread app which loads a bunch of tiles that makeup a large bitmap. The app was becoming very sluggish when it would load the new tiles into system memory. Im now looking trying to use Async Tasks for this purpose. The app detects which tile is in the top left in a method called by onDraw, creates...

Android AsyncTask Pub Sub to Context?

An activity I have starts an AsyncTask. What is the best way of getting the Activity notified that the AsyncTask is done. I can pass the Activity as a Context in, but I don't want the AsyncTask to know about the type of the Activity. In .NET land I would subscribe to an event on the "AsyncTask". I didn't find a way to do that in Android...

How to load complex views concurrently

I have an Android activity that creates custom views, and it is an expensive process. I tried to use a Handler, but when I do, the progress dialog that shows, spins like once every 5 seconds. So I tried to use an AsyncTask. Now the progressDialog spins, but then it crashes, because it isn't allowed to load the UI? How can I do this witho...

My application freezes EVO 4Gs (and everything else)

When a user presses the back key to my first activity, where I start an AsyncTask duringonCreate() that checks to see if buttons should be enabled based on whether or not websites are down. I use an HttpClient to contact www.downforeveryoneorjustme.com to determine if the site is down. When users return to this Activity the phone becomes...

How to Create/Run AsyncTask in Service without runOnUiThread()

I have a Service that creates AsyncTasks for downloading files. In activities, we create Runnables or Threads that we pass to Activity.runOnUiThread(). I can't access that method from a service, so how do I use AsyncTask correctly, (do heavy work without blocking the UI Thread)? ...

Handling interrupted exception of AsyncTask in Android?

Hi, I am using AsyncTask in my application. The problem is that when server is down the AsyncTask throws an Interrupted exception. How to track that whether server is down or not. ` HttpGet httpget = new HttpGet(urls[i]); ResponseHandler<String> responseHandler = new BasicResponseHandler(); content = httpClient.execute(httpget, re...

Is there a sophisticated Java WorkQueue API?

I am looking for a WorkQueue API offering the following features: java.util.Queue compatible offers (optional) Set-semantic single- and batch-processing concurrency (of course) scheduling different processing policies wait until next scheduled execution pre-process, if batch size met delayed processing (minimum time in queue, before b...

Display Toast, Android

Hi, I have a slider that can be pulled up and then it shows a map. I can move the slider up and down to hide or show the map. When the map is on front, I can handle touch events on that map. Everytime I touch, a AsyncTask is fired up, it downloads some data and makes a Toast that displays the data. Although I start the task on touch eve...

What kills an Android AsyncTask?

PrintStatusTask parses the contents of a gmail inbox looking for various items of interest to report on. But a new AsyncTask is created for each PrintStatusTask().execute() according to the debugger. Shouldn't these tasks die on exit? Do they have to be killed manually? public class Controller extends Activity { ... private bool...

AsyncTask interrupted exception in Android?

I am facing an issue with AsynsTask in my Application. I really do not understand the reason of it happening. The issue is "The application works perfectly usually, now when any of the activity is displayed on the screen and I keep my device idle for a longer period of time. Then when I make the keyguard on the view of the last active a...

Android AsyncTask problem

Hi! I have a string that I want to update using AsyncTask class here is my code: public class MainActivity extends Activity{ private String str = "oldString"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); se...

Keeping an AsyncTask alive in low memory conditions?

I have written a home screen widget as an ImageView, ie. the code generates the whole widget and writes it to RemoteViews as a bitmap. On slower devices with low memory, such as my G1, it can take a couple of seconds to generate the bitmap, and to avoid the dreaded force-close, I moved all the graphics code into an AsyncTask. So far so g...

Android Threading Issue

I have the following code that I want to be able to loop every 30 seconds. MyLocation myLocation = new MyLocation(); public LocationResult locationResult = new LocationResult() { @Override public void gotLocation(final Location location) { GeoPoint myGeoPoint = new GeoPoint( (int) (loc...

Confused about how to approach a registration and polling of messages with Android

Dear stackies, what I need to do is auto-register device if not already done and then start polling messages with the credentials I received through this registration. Now, after I read quite a bit about services, threads, asynctasks and the AlarmManager I'm totally confused about how to handle this. :-s So, there are my two main task...

onPostExecute not called after completion AsyncTask

For some reason my onPostExecute() is not called after my AsyncTask finishes. My class decleration: public class setWallpaperForeground extends AsyncTask<String, Integer, Boolean> My onPostExecute(): protected void onPostExecute(Boolean result) Everything works fine, my doInBackground() completes successfully and returns a Boolean b...