title: AsyncTask in android 4.2.2
body: <p>I'm trying to execute some code parallel with threads using async task.
  But for some reason in android 4.2.2 doesn't work.</p>
  
  <p>I have this code which is in main class:</p>
  
  <pre><code>new XmlDownloader();
  
  task=new SendTask().execute("");
  </code></pre>
  
  <p>and the following classes:</p>
  
  <pre><code> private class SendTask extends AsyncTask&lt;String,String,String&gt;{
  
  
  
          @Override
          protected void onPreExecute(){
  
          }
  
          @Override
          protected String doInBackground(String...strings){
  
                 while(true){                               
  
                      Log.w("outside", "hello");  
               }            
            }
  
              return strings[0];
          }
  
          @Override
          protected void onPostExecute(String country){
  
  
          }
       }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    public class XmlDownloader extends Activity {
  
  
  public XmlDownloader(int pos) {
  
  
      DownloaderTask task = new DownloaderTask();
  
      task.execute("");
  }
  
  
  private String downloadXml(String s,int pos1) {
  
      return null;
  }
  
  
  private class DownloaderTask extends AsyncTask&lt;String, Void, String&gt; {
  
      public DownloaderTask() {
  
      }
  
      @Override
      // Actual download method, run in the task thread
      protected String doInBackground(String... params) {
  
           while(true){
               Log.w("down", "asdasdasssasdasdasdasd");   
               if(isCancelled())
                   return null;
           };
  
  
           return null;
  
      }
  
      @Override
      // Once the image is downloaded, associates it to the imageView
      protected void onPostExecute(String bitmap) {
  
  
      }
  }
   }
  </code></pre>
  
  <p>In android 2.3.3 the logcat shows this sequence</p>
  
  <pre><code> Log.w("down", "asdasdasssasdasdasdasd");   
   Log.w("down", "asdasdasssasdasdasdasd");   
   Log.w("down", "asdasdasssasdasdasdasd");       
   Log.w("outside", "hello");
   Log.w("outside", "hello");
   Log.w("down", "asdasdasssasdasdasdasd");   
  </code></pre>
  
  <p>but in android 4.2.2 only shows</p>
  
  <pre><code>   Log.w("down", "asdasdasssasdasdasdasd"); 
     Log.w("down", "asdasdasssasdasdasdasd"); 
     Log.w("down", "asdasdasssasdasdasdasd"); 
     Log.w("down", "asdasdasssasdasdasdasd"); 
     Log.w("down", "asdasdasssasdasdasdasd"); 
  </code></pre>
  
  <p>Any ideas why threads don't work?</p>