realtebo
realtebo

Reputation: 25691

Exception when Calling AlertBuilder from AsyncTask

I've a main activity.

In this I've defined a function for use AlertBuilder passing a stringId from resource file.

I'm trying to use this for showing an error when not enough space left on disk, from my AsyncTask.

But when calling context.showAlert i got a runtime exception

09-09 14:41:44.812: E/Background(8963): Can't create handler inside thread that has not called Looper.prepare()

Why ?

Upvotes: 1

Views: 91

Answers (1)

MByD
MByD

Reputation: 137382

You should modify the UI (as in this call) from one of the function that are called on the main thread, not in the background.

E.g. from one of the following:

  • onProgressUpdate

  • onPostExecute

Upvotes: 2

Related Questions