3
I’m trying to figure out how to set up a Activity to return to the Activity previous in AndroidManifest?
3
I’m trying to figure out how to set up a Activity to return to the Activity previous in AndroidManifest?
4
The hierarchy of Activity is configured in manifest, where we can define which navigation is expected between them:
Example:
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ResultActivity"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/>
</activity>
In the example above, the MainActivity is defined as the predecessor of ResultActivity.
This subject is addressed in some detail in the training examples at:
0
I didn’t understand your question properly but all the Activity'will come out of Activity MAIN, when you call the method onBackPressed() (English) she will close the current and return to which was called.
Example:
MAIN --> Activity1 --> Activity2 \/
MAIN <-- Activity1 <-- Activity2
Move forward: new Intent(); (English)
Return: onBackPressed(); (English)
Remembering that this is already done automatically there is no need to implode the onBackPressed() unless he wanted some more function.
Browser other questions tagged android android-manifest android-activity
You are not signed in. Login or sign up in order to post.
I tried to do this and my application gave crash.
– Israel Sousa
I found this business of setting up the hierarchy of activities a little prolific, is it really necessary? From what I understand the documentation cites two possible situations when a notification is clicked, open the activity at the top of the current backstack or open in a new backstack that only contains the activity. In none of the cases I see need to specify the hierarchy, I simply click on the notification and the activity is opened at the top of the backstack or in a new backstack depending on the Intent flags that were used.
taskAffinityandexcludeFromRecentsare of use, edge cases of navigation?– Piovezan