android - Program a 'Back' button to return to the previous activity -
i new please kind. have searched , read lot i'm totally confused. have number of activities 1 thru 10. can go activity 4 both activity 3 , 8. 'back' button on activity 4 returns me activity 3. want take me previous activity (3 or 8), please.
here current java code:
public class player_new extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_4_new); intent intent = getintent(); string message = intent.getstringextra(mainactivity.extra_message); } public void sendbackmessage(view view) { intent intent = new intent(this, 3.class); startactivity(intent); } }
tia john
activity a: startactivity(new intent(a.this, b.class);
in activity b
@override public void onbackpressed() { finish(); }
Comments
Post a Comment