Here is the question: Let's say the activity stack consist of A->B->C.
If user followed the order eg: Start A -> B -> C, pressing back button will cause C->B->A. However, if user entered directly into activity C (eg: via notification), pressing back button will cause the app to close, instead of going into B->A.
How do I insert the into the activity stack to become A->B->C, so that when user pressed back at C, it will always back to B.
Thanks
just overide the onBackPressed() method and startactivity B in activityc and startactivity a in activity b.
in activty c have these code::
public void onBackPressed(){
startActivity(new Intent(this,ActivityB.class));
finish();
}
and in activity b have these code::
public void onBackPressed(){
startActivity(new Intent(this,ActivityA.class));
finish();
}
and in activity a have these code::
public void onBackPressed(){
finish();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With