I have this actual navigation tree :
A => B => C
According to configuration B can be skipped and the navigation become :
A => C
Whatever the case is , B stay C's parent.
So when i navigate to C (through B or not) i expect to reach B when i touch the up button of the action bar.
My manifest is defined like this :
<activity android:name="my.package.A"></activity>
<activity android:name="my.package.B"></activity>
<activity android:name="my.package.C"
android:parentActivityName="my.package.B">
</activity>
My app targets android 4.1 and more , so no need for the <meta data>
tag
C activity is set up like this:
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_int);
getActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
So, according to the documentation, when i touch "up" B activity should be created or bringed back.
Problem :
When i skip B (going from A to C) , if i touch "up" the application is closing (because A has been finished, expected behavior) whereas it should create B.
In onOptionsItemSelected()
shouldUpRecreateTask()
always return false even if B does not exist.
If i navigate to C through B (A=>B=>C) the up button correctly bring back B.
What am i doing wrong ?
Thanks.