I am trying to set Back option from one activity to other
- Activity CategoryRegister has parent Register Activity .
- Activity Register has parent LoginActivity
When I go back from wither of above I go back to login register , while for categoryregister activity I should go back to Register activity.
Part of manifest file:
<activity
android:label="Login Account"
android:name=".LoginActivity"></activity>
<activity
android:label="Register New Account"
android:parentActivityName=".LoginActivity"
android:name=".RegisterActivity"></activity>
<activity
android:label="Select Category"
android:parentActivityName=".RegisterActivity"
android:name=".CategoryRegister"></activity>
Procedure to setup back navigation :
getActionBar().setDisplayHomeAsUpEnabled(true);
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_register:
return true;
break;
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
default:
return true;
}
Thanks in advance . I really don't get this behavior . Did anyone face similar issues?
Using the above manifest its working for parent->child , but in case of parent->child1->child2 (child2 up button takes back to parent, but not child1 , which is parent of child2 as described in android manifest.