Up Navigation from Actionbar in Android -


in android app using up navigation icon on actionbar. in child activity have set

actionbar actionbar = getactionbar(); actionbar.setdisplayhomeasupenabled(true); 

in manifest have set

<activity         android:name="app.sclms.useraccount"         android:label="@string/app_name"         android:parentactivityname="app.sclms.mainmenu">         <meta-data             android:name="android.support.parent_activity"             android:value="app.sclms.mainmenu" />  </activity> 

but whenever click on icon application exited.

what missing here, don't understand.

please read section: http://developer.android.com/training/implementing-navigation/ancestral.html#navigateup

specifically, add code:

@override public boolean onoptionsitemselected(menuitem item) {     switch (item.getitemid()) {     // respond action bar's up/home button     case android.r.id.home:         navutils.navigateupfromsametask(this);         return true;     }     return super.onoptionsitemselected(item); } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -