I am creating a menu system like this on several activies to switch between each
public override bool OnCreateOptionsMenu(IMenu menu)
{
MenuInflater.Inflate(Resource.Menu.menu, menu);
return base.OnCreateOptionsMenu(menu);
}
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.hauptprogramm:
StartActivity(typeof(Hauptprogramm));
return true;
case Resource.Id.erweitern:
StartActivity(typeof(Erw));
return true;
}
return base.OnOptionsItemSelected(item);
}
But using StartActivity(typeof(Hauptprogramm));
it seems to create a new copy of the activity in memory each time instead of creating it once and switching between them. How to switch between Erw
and Hauptprogramm
quickly without creating new instances each time? Also when I use the "hardware"-back button, it does not go back to the main screen but through my whole back and forth history. How to have pressing the back-button always go back to the main screen and if pressed there, leave the app, no matter how my back and forth history was?