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

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -