I have a listview which have checkboxes. For each checkbox (they are about 3), it has a specific AsyncTask for it.
I never know what checkboxes use
Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
You are trying to display a lertdialog inside doInbackground
. doInbackground
is invoked on a backgroudn thread. and ui should be updated on the ui thread.
You can return result of background computation in doInbackground
and update ui in onPostExecute
. Or use runOnUiThread
which is a method of activity class. or show dialog in onProgressUpdate(Progress...)
http://developer.android.com/reference/android/os/AsyncTask.html
Also check the topic under Threads
@ http://developer.android.com/guide/components/processes-and-threads.html
When an application is launched, the system creates a thread of execution for the application, called "main." This thread is very important because it is in charge of dispatching events to the appropriate user interface widgets, including drawing events. It is also the thread in which your application interacts with components from the Android UI toolkit (components from the android.widget and android.view packages). As such, the main thread is also sometimes called the UI thread.
Also use activity context
alertDialog = new AlertDialog.Builder(ActivityContext).create();