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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -