Issue
I am trying to use an AsyncTask class that I created to update a MapView. The problem is I am getting this error when I make my call to execute the AsyncTask:
"Can't create a Handler inside a thread that has not called Looper.prepare()"
I have tried running the Task on the UI Thread using
Handler hand = new Handler(Looper.getMainLooper());
hand.post(new Runnable() {
public void run() {
new RxThread().execute();
}
});
But that just gives me the same error. I realize that my MapView doesn't call looper prepare, and that I'm having troubles getting this to work since I'm running the MapView on a seperate activity rather than the Main Activity. Does anyone have a good solution to this?
Solution
IIRC, your error is because you are first referencing AsyncTask on a background thread. You can only create and execute() an AsyncTask on the main application thread.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.