You are using setContentView
, so you are just changing the view layout. When you press the backbutton, the Android calls onBackPressed
, which the default implementation is to call finnish()
method, that closes the activity.
You can override the onBackPressed
method to set the other view.
@Override
public void onBackPressed()
{
//setContentView the previous view
}
Hope it helps!