android - startactivity from onpostexecute() of Asynctask pushes screen even when the application is not in foreground -
i'm trying launch activity onpostexecute of asynctask. if application goes background while asynctask being executed, activity getting pushed phone's launcher screen. due default behaviour of asynctask. there way of avoiding behaviour?
when activity going become no longer visible user (home button pressed, etc) onpause()
method called.
@override public void onpause() { super.onpause(); if (myasynctask != null) { myasynctask.cancel(true); // allow task interrupted if in progress } }
this assuming have reference asynctask in activity. if post code i'd better able provide solution.
Comments
Post a Comment