While it should be defined if upward navigation or backstack synthesis is desired, note that the attribute android:parentActivityName
was introduced in API Level 16.
For prior releases, parent activity information is accessed from attributes defined inside of a <meta-data>
tag that is declared inside of the child <activity>
tag.
Example:
<activity
android:name=".DetailActivity"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
</activity>
Inside of the <meta-data>
tag, set the android:name
attribute to android.support.PARENT_ACTIVITY
, and the android:value
attribute to the parent activity class name (i.e. the same class name as that assigned to android:parentActivityName
).
Unless API level is known, both the <meta-data>
and inline specifications are recommended.
For more on specifying the parent activity, see: https://developer.android.com/training/implementing-navigation/ancestral.html#SpecifyParent
In addition, consider defining the android:launchMode
attribute inside of your main <activity>
tag to set the desired behavior of upward navigation: https://developer.android.com/guide/topics/manifest/activity-element.html#lmode