Asynchronous task
<p>I have created an asynchronous task like this:</p>

<pre><code>private class LongOperationcheckall extends AsyncTask&lt;String, String, String&gt; {

    @Override
    protected String doInBackground(String... params) {
        String result="Start";
        try
        {
            Looper.myLooper().prepare();
            // Looper.loop();

            // TODO Auto-generated method stub
            for(int k=0;k&lt;13;k++)
            {
                checkall();
                this.publishProgress("Show the dialog");

                //count++;
            }

            result="Success";
            checkallcomp++;

            OnscanComplete();
        }
        catch(Exception ex)
        {
            checkallcomp++;
            OnscanComplete();
        }
        return result;
    }

    @Override
    protected void onProgressUpdate(String... values) {
        super.onProgressUpdate(values);
        Log.i("Progress", "Progressincheck");
    }

    protected void onPostExecute(String params ) {
        Log.w("all Check",params);

        // Execution of result of Long time consuming operation
    }
}
</code></pre>

<p>I have added code,</p>

<pre><code>Looper.myLooper().prepare();
</code></pre>

<p>to call to this task as</p>

<pre><code>taskAllcheck = new LongOperationcheckall();
taskAllcheck.execute();
</code></pre>

<p>The fourth time when I click on start button the fourth time, it gives the exception </p>

<blockquote>
  <p>Can't create handler inside the thread inside thread which not called looper.prepare </p>
</blockquote>

<p>Only, when I run in the device it executes OK in the emulator, but after add this line, the error comes as only one looper may be created per thread when I click on the start button for the fourth time and call <code>taskAllcheck.execute();</code>.</p>
