Threading Example in Android


Question

I want some simple example on thread creation and invoking of threads in android.

1
72
4/29/2015 8:12:15 PM

Accepted Answer

86
9/14/2012 1:33:41 PM

One of Androids powerful feature is the AsyncTask class.

To work with it, you have to first extend it and override doInBackground(...). doInBackground automatically executes on a worker thread, and you can add some listeners on the UI Thread to get notified about status update, those functions are called: onPreExecute(), onPostExecute() and onProgressUpdate()

You can find a example here.

Refer to below post for other alternatives:

Handler vs AsyncTask vs Thread


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon