By Alvin Alexander. Last updated: June 6, 2016
When you want to provide Up/Back/Home navigation in an Android sub-activity, this Java code doesn’t seem to be needed:
getActionBar().setDisplayHomeAsUpEnabled(true);
The “Add Up Action” docs on this Android.com page state that is needed, but as of some (unknown) Android version it is not needed. All you need to do is specify the “Up/Parent” activity in your AndroidManifest.xml file, like this:
<activity android:name="com.alvinalexander.motify.NewQuoteActivity" android:label="@string/title_add_quote" android:theme="@style/ActionBarWithHomeArrowTheme" android:parentActivityName=".QuotesListActivity" />
I’m not sure about Android version specifics, but I’m developing my app with a minSdkVersion
of 16 and my Up/Back buttons work fine without the Java code.