mardi 8 avril 2014

Android écrans noirs aléatoires en raison des asynctask ou autre chose lors du passage des activités - Stack Overflow


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.


Anyone had the same issue ? or a solution ?


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.


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:


     response.getEntity().consumeContent(); just after the get the response

and


    mtask.cancel(); (après isCancelled) in the post execution section

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.


My guess is maybe because I setbackground after oncreate through my app which may generate some workload. But it didn't.


I switched my launch mode parameters to cleartaskatlaunch and it is slightly better but I still get the black screen pretty often.


5am here... going to bed hoping i will find an answer tomorrow.


Thank you


Laurent



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.


Anyone had the same issue ? or a solution ?


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.


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:


     response.getEntity().consumeContent(); just after the get the response

and


    mtask.cancel(); (après isCancelled) in the post execution section

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.


My guess is maybe because I setbackground after oncreate through my app which may generate some workload. But it didn't.


I switched my launch mode parameters to cleartaskatlaunch and it is slightly better but I still get the black screen pretty often.


5am here... going to bed hoping i will find an answer tomorrow.


Thank you


Laurent


0 commentaires:

Enregistrer un commentaire