I have MenuActivity with "new game" and "resume" buttons. "new game" starts FireRoomActivity.
public void newGame(View view){
Intent intent = new Intent(this, FireRoomActivity.class);
this.finish();
startActivity(intent);
}
In FireRoomActivity the onBackPressed is overriden to go back to MenuActivity.
@Override
public void onBackPressed() {
super.onBackPressed();
Intent inMain=new Intent(this, MenuActivity.class);
startActivity(inMain);
}
The "resume" button in MenuActivity should resume FireRoomActivity.But this just quits app.
public void resume(View view){
this.finish();
}
Q1) What am I doing wrong?
Q2) If I add third activity "ThreeActivity" and start it from FireRoomActivity(finishing FireRoomActivity), and in this "ThreeActivity" override onBackPressed to go to MenuActivity, how would I go about it?
I'm new to android life cycle, so I would appreciate detailed reply