I get a crash “Can’t create handler inside thread that has not called Looper.prepare()” in a onPreExecute in a thread. It was my understanding that onPreExecute runs on the UI Thread, so how can it crash?
public void onPreExecute() {
if (loading == null || !loading.isShowing())
loading = ProgressDialog.show(co, "",
"Retrieving Geolocation...", true);
}
Quite strangely, it works sometimes, and sometimes not
AsyncTaskThreading rules (few paragraphs down) state:My guess is that you called
execute()on background thread.