title: Android random black screens due to asynctask or something else when switching activities
body: <p>I created an app which works fine on emulators but sometimes, when switching from an activity to another on a real device (Samsung Note 2), i get a black screen and then after one second, I am forwarded to my previous activity.</p>
  
  <p>Anyone had the same issue ? or a solution ?</p>
  
  <p>For example (letters are activities)
  I go to A -> B -> C -> D then go back to A ->B and then black screen to access to C and goes back to B.</p>
  
  <p>My activities are simple ones which are simply forms. At first, i thought it was because I had several asynctasks to reach the internet (submit forms, login, download or upload pictures) but I always add:</p>
  
  <pre><code>     response.getEntity().consumeContent(); just after the get the response
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    mtask.cancel(); (après isCancelled) in the post execution section
  </code></pre>
  
  <p>After, I thought it was because i have a lot of: putExtraString but I checked that it was not enough data to cause any issues.</p>
  
  <p>My guess is maybe because I setbackground after oncreate through my app which may generate some workload. But it didn't.</p>
  
  <p>I switched my launch mode parameters to cleartaskatlaunch and it is slightly better but I still get the black screen pretty often.</p>
  
  <p>5am here... going to bed hoping i will find an answer tomorrow.</p>
  
  <p>Thank you</p>
  
  <p>Laurent</p>