Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating a looping background task
    primarykey
    data
    text
    <p>I'd like to create an AsyncTask that sits in the background and calls a web service every X seconds.</p> <pre><code> private class BackgroundTask extends AsyncTask&lt;Integer, Integer, Boolean&gt; { protected Boolean doInBackground(Integer... params) { if (params.length &gt; 0) { int intUserId = params[0]; if (intUserId != -1) { boolean blnRunning = true; while (blnRunning) { // perform query try { this.wait(15000); } catch (InterruptedException e) { blnRunning = false; } } } } return false; } protected void onPostExecute(Boolean blnLaunchStoreFavorites) { // do something? } } </code></pre> <p>This is what I have.</p> <p>Shortly after this.wait() is called, I get an error down in the bowels of ThreadPoolExecuter.class.</p> <pre><code>Uncaught handler: thread AsyncTask #2 exiting due to uncaught exception 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:273) at java.util.concurrent.FutureTask.setException(FutureTask.java:124) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561) at java.lang.Thread.run(Thread.java:1096) </code></pre> <p>I'm not quite sure what is going on here. Any ideas?</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.
 

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