short problem description: starting new activity @ menu seems lead multiple main activities (at least via 'back' navigation), , can not find "standard" way navigate activities.
details: writing small, simple , straight forward app 1 main activity , 2 "sub" activities, namely show
, settings
. both sub activities declared android:parentactivityname="mainactivity"
. in menu want let user switch between activities.
i have read android developer tutorial create menu, tutorial stops @ newgame()
, showhelp()
in onoptionsitemselected
. other tutorials led following:
public boolean onoptionsitemselected(menuitem item) { log.d(tag, "onoptionsitemselected! " + item.getitemid()); intent intent; // handle item selection switch (item.getitemid()) { case r.id.settingitem: intent = new intent(this, settingsactivity.class); startactivity(intent); return true;
...
of course main activity should included in menu, want "up" , "back" working usual.
so question style androidish? main activity quite expensive in creating, since uses camera , camerapreview.
destroy mainactivity finish() everytime 'settings' or 'show' called, , create again on 'back', 'up' , 'main activity' events?
write 3 different menus or onoptionsitemselected main activity (which nothing when 'main activity' chosen) , each sub activity?
save intent main activity , try reuse this?
if there tutorial out there (for api level >= 11) defining simple switching between apps, read it. i'm quite lost in have found now.