Skip to content Skip to sidebar Skip to footer

How To Properly Use AsyncTask

I want to capture a frame buffer from a camera surface preview and send those buffers to another function to be processed / POSTed somewhere on the web. The Android Dev guide give

Solution 1:

It will be a single thread, taken from a managed thread pool. The argument ellipsis is simply the input to your doInBackground method. As you can see from the example, no threads are spawned in there. If you want to use one thread per URL, you'll have to create a new AsyncTask for each of them.


Solution 2:

It is one thread that is looping over the data.

You can do the latter too.

With the 2nd option, you need to take the heap size into account, as the handset only has a limited amount of memory and many parallel threads, all downloading in big buffers may overrun the available memory.


Post a Comment for "How To Properly Use AsyncTask"