android - startActivity in onPause() not working after opening new app -
i start second activity when first activity paused.
firstactivity.java
@override public void onpause(){ super.onpause(); startactivity(new intent(this, secondactivity.class)); }
when press on homescreen button, secondactivity start delay. in delay, there enough time open new app (like messenger instance). however, when open new app, secondactivity not start anymore (it won't call oncreate method of secondactivity).
how can still start secondactivity when open new app?
override onbackpressed() method , start new activity there, instead of adding code onpause().
@override public void onbackpressed() { startactivity(new intent(this, secondactivity.class)); super.onbackpressed(); }
Comments
Post a Comment