Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot solve android.view.ViewRoot$CalledFromWrongThreadException. Help needed?
    primarykey
    data
    text
    <p>after searching i've found that some phones (like the Galaxy s) are affected by a strange bug or whatever that cause this error:</p> <pre><code> java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:200) at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274) at java.util.concurrent.FutureTask.setException(FutureTask.java:125) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) at java.lang.Thread.run(Thread.java:1019) Caused by: android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRoot.checkThread(ViewRoot.java:2934) at android.view.ViewRoot.invalidateChild(ViewRoot.java:643) at android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:669) at android.view.ViewGroup.invalidateChild(ViewGroup.java:2511) at android.view.View.invalidate(View.java:5279) at android.webkit.WebView.selectionDone(WebView.java:4470) at android.webkit.WebView.clearHelpers(WebView.java:1295) at android.webkit.WebView.loadDataWithBaseURL(WebView.java:1714) at c.a(Unknown Source) at c.doInBackground(Unknown Source) at android.os.AsyncTask$2.call(AsyncTask.java:185) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306) ... 4 more android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRoot.checkThread(ViewRoot.java:2934) at android.view.ViewRoot.invalidateChild(ViewRoot.java:643) at android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:669) at android.view.ViewGroup.invalidateChild(ViewGroup.java:2511) at android.view.View.invalidate(View.java:5279) at android.webkit.WebView.selectionDone(WebView.java:4470) at android.webkit.WebView.clearHelpers(WebView.java:1295) at android.webkit.WebView.loadDataWithBaseURL(WebView.java:1714) at c.a(Unknown Source) at c.doInBackground(Unknown Source) at android.os.AsyncTask$2.call(AsyncTask.java:185) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) at java.lang.Thread.run(Thread.java:1019) </code></pre> <p>And this is the logcat if needed and from here it seems that is problem of the swipe function:</p> <pre><code> 10-27 19:19:20.329 I/InputReader( 166): dispatchTouch::touch event's action is 1 10-27 19:19:20.329 I/InputDispatcher( 166): Delivering touch to current input target: action: 1, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)' 10-27 19:19:20.749 I/InputReader( 166): dispatchTouch::touch event's action is 0 10-27 19:19:20.749 I/InputDispatcher( 166): Delivering touch to current input target: action: 0, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)' 10-27 19:19:21.689 I/InputReader( 166): dispatchTouch::touch event's action is 1 10-27 19:19:21.689 I/InputDispatcher( 166): Delivering touch to current input target: action: 1, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)' 10-27 19:19:21.689 W/webview ( 1125): Miss a drag as we are waiting for WebCore's response for touch down. 10-27 19:19:21.989 I/InputReader( 166): dispatchTouch::touch event's action is 0 10-27 19:19:21.989 I/InputDispatcher( 166): Delivering touch to current input target: action: 0, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)' 10-27 19:19:22.159 I/Ads ( 1125): Refreshing ad. 10-27 19:19:22.169 I/webclipboard( 1125): clipservice: android.sec.clipboard.ClipboardExManager@4051cb08 10-27 19:19:22.259 I/Ads ( 1125): adRequestUrlHtml: &lt;html&gt;&lt;head&gt;&lt;script src="http://www.gstatic.com/afma/sdk-core-v40.js"&gt;&lt;/script&gt;&lt;script&gt;AFMA_buildAdURL({"preqs":15,"u_sd":1.0,"u_w":320,"slotname":"a14e098781b871d","msid":"***PACKEGE_NAME***","js":"afma-sdk-a-v4.0.4","isu":"F1B8EEEA64C5716BA996D22689C17557","format":"320x50_mb","net":"wi","app_name":"4.0.4.android.***PACKEGE_NAME***","hl":"pt","u_h":480,"u_so":"p","u_audio":1,"prl":792});&lt;/script&gt;&lt;/head&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt; 10-27 19:19:22.449 I/InputReader( 166): dispatchTouch::touch event's action is 1 10-27 19:19:22.449 I/InputDispatcher( 166): Delivering touch to current input target: action: 1, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)' 10-27 19:19:22.449 W/webview ( 1125): Miss a drag as we are waiting for WebCore's response for touch down. 10-27 19:19:22.599 I/Ads ( 1125): Received ad url: &lt;"url": "http://googleads.g.doubleclick.net:80/mads/gma?preqs=15&amp;u_sd=1&amp;u_w=320&amp;slotname=a14e098781b871d&amp;msid=***PACKEGE_NAME***&amp;js=afma-sdk-a-v4.0.4&amp;isu=F1B8EEEA64C5716BA996D22689C17557&amp;format=320x50_mb&amp;net=wi&amp;app_name=4.0.4.android.***PACKEGE_NAME***&amp;hl=pt&amp;u_h=480&amp;u_so=p&amp;u_audio=1&amp;prl=792&amp;output=html&amp;region=mobile_app&amp;u_tz=240&amp;ex=1&amp;client_sdk=1&amp;askip=0", "afmaNotifyDt": "null"&gt; 10-27 19:19:22.609 I/InputReader( 166): dispatchTouch::touch event's action is 0 10-27 19:19:22.609 I/InputDispatcher( 166): Delivering touch to current input target: action: 0, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)' 10-27 19:19:23.339 W/dalvikvm( 1125): threadid=11: thread exiting with uncaught exception (group=0x40018578) 10-27 19:19:23.339 E/ACRA ( 1125): ACRA caught a RuntimeException exception for ***PACKEGE_NAME***. Building report. 10-27 19:19:23.339 D/ACRA ( 1125): Retrieve application default SharedPreferences. 10-27 19:19:23.349 V/webview ( 1125): ZoomScale 3 mPreserveZoom: false 10-27 19:19:23.489 I/ACRA ( 1125): READ_LOGS granted! ACRA can include LogCat and DropBox data. 10-27 19:19:23.519 D/ACRA ( 1125): Retrieving logcat output... </code></pre> <p>The only thing that can cause this error is a Timer that i use in my application in the game Intent, i tried to set up a handler but i saw a lot of crash in my ACRA log.</p> <p>This is the content of my intent, i hope that someone should help me :)</p> <pre><code> startB.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { startB.setEnabled(false); partiColTempo(tempox); } }); } private void displayText(final String text){ this.runOnUiThread(new Runnable(){ //@Override public void run() { tempo.setText(text); if (text.equals("Finished")){ eseguiSuono(); assegnaPunti(); startB.setEnabled(true); //elapsed=0; tempo.setText("Waiting"); } }}); } private void partiColTempo(int tempox) { TIMEOUT=tempox*1000; Log.w("tempo timer", ""+tempox); elapsed=INTERVAL; TimerTask task=new TimerTask(){ @Override public void run() { elapsed+=INTERVAL; if(elapsed&gt;TIMEOUT){ this.cancel(); displayText("Finished"); return; } //if(some other conditions) // this.cancel(); displayText(getString(R.string.tempo_rim)+" " + (TIMEOUT-elapsed) / 1000); } }; Timer timer = new Timer(); timer.scheduleAtFixedRate(task, INTERVAL, INTERVAL); </code></pre> <p>Is the problem there? Because i can't find other place when i call asynctask.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload