So I have two layouts and I switch to the second layout when the ImageButton
is pressed. On my nexus 6, how do I keep the first layout running so when I'm on the second layout and press back it would show the first layout?
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageButton ImageButton = (ImageButton) findViewById(R.id.image);
ImageButton.setBackgroundColor(1);
ImageButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view)
{
setContentView(R.layout.layoutsecond);
}
});
}
}