Android: raise AlertDialog from background thread Android: raise AlertDialog from background thread multithreading multithreading

Android: raise AlertDialog from background thread


I ended up doing something like this in my background thread. It works, but not sure if it is a "good" solution.

Looper.prepare();mActivity.showDialogAlertDefault();Looper.loop();Looper.myLooper().quit();


This probably means the right way is to use a Service, instead of a plain background thread. Your background work will be more resilient to being paused or shut down, and you don't have to worry about making an AsyncTask that is constantly keeping track of a different Activity parent.