Note that there are some explanatory texts on larger screens.

plurals
  1. POBasic Android AsyncTask, an error occurred while executing doInBackground()
    primarykey
    data
    text
    <p>[solved]</p> <p>I'm trying to create a basic thread using AsyncTask as shown in the documentation for the Android API. However, I'm coming across an error when trying to execute the most simplest of threads.</p> <pre><code> AsyncTask task = new AsyncTask&lt;Void, Integer, Boolean&gt;() { @Override protected Boolean doInBackground(Void... arg0) { try { Thread.sleep(6000); System.out.println("DELAYED TEST TEST TEST"); }catch(Exception e) { } return true; } }; </code></pre> <p>Logcat entry:</p> <pre><code>E/AndroidRuntime(21215): FATAL EXCEPTION: AsyncTask #1 E/AndroidRuntime(21215): java.lang.RuntimeException: An error occured while executing doInBackground() E/AndroidRuntime(21215): at android.os.AsyncTask$3.done(AsyncTask.java:200) E/AndroidRuntime(21215): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274) E/AndroidRuntime(21215): at java.util.concurrent.FutureTask.setException(FutureTask.java:125) E/AndroidRuntime(21215): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308) E/AndroidRuntime(21215): at java.util.concurrent.FutureTask.run(FutureTask.java:138) E/AndroidRuntime(21215): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) E/AndroidRuntime(21215): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581) E/AndroidRuntime(21215): at java.lang.Thread.run(Thread.java:1027) E/AndroidRuntime(21215): Caused by: java.lang.ClassCastException: [Ljava.lang.Object; E/AndroidRuntime(21215): at hlf.scenes.Intro$2.doInBackground(Intro.java:1) E/AndroidRuntime(21215): at android.os.AsyncTask$2.call(AsyncTask.java:185) E/AndroidRuntime(21215): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306) E/AndroidRuntime(21215): ... 4 more </code></pre> <p>If anyone could help me solve this I'd be really appreciative! Thanks</p> <p>Fix:</p> <pre><code>AsyncTask&lt;Void, Integer, Boolean&gt; task = new AsyncTask&lt;Void, Integer, Boolean&gt;() </code></pre>
    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