java.lang.IllegalStateException: Calling View methods on another thread than the UI thread

Jorgesys picture Jorgesys · Nov 28, 2013 · Viewed 9.3k times · Source

When trying to open a webview on my nexus 4 now with Android 4.4 (Kit kat) I'll getting this error message:

Calling View methods on another thread than the UI thread.; 
java.lang.IllegalStateException: Calling View methods on another thread than the UI thread.
com.android.webview.chromium.WebViewChromium.createThreadException(WebViewChromium.java:268)

Since i update to Android 4.4 my Nexus 4.

Answer

Jerome picture Jerome · Nov 28, 2013

what's your code like? you can try

 runOnUiThread(new Runnable() {
        @Override
        public void run() {

            // TODO Your code
        }
    });