Skip to content Skip to sidebar Skip to footer

Only The Original Thread That Created A View Hierarchy Can Touch Its Views.onprogressupdate

Starting from Android 4.0 I have the problem ( on 2.3.6 it is working). onProgressUpdate it should be already in UI thread. I have tried activity.runOnUiThread now is with a Handle

Solution 1:

Create handler only once in onPreExecute() which is called from UI thread and save a reference to it, than post to it in onProgressUpdate().

Handler posts to thread that it has been created on.

Solution 2:

The following worked for me.

myHandler.post(new Runnable() {
            publicvoidrun() {
                dlg.setMessage(msg);
            }
        });

Post a Comment for "Only The Original Thread That Created A View Hierarchy Can Touch Its Views.onprogressupdate"