Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to navigate up to the same parent state
    text
    copied!<p>From my observation from Gmail and TED app the behavior of up navigation it will navigate to parent with the same state (scroll position) not like what Google say in their doc <a href="http://developer.android.com/training/implementing-navigation/ancestral.html" rel="nofollow">Implement Up Navigation</a> which like create a parent intent and start it. </p> <p>I implement the code from Android sample code and all state are gone (All Extra parameters I have previously set and scroll position). What is the proper way on this ? I can't find any on Android document.</p> <p>Below is the code:</p> <pre><code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent upIntent = new Intent(this, MyParentActivity.class); if (NavUtils.shouldUpRecreateTask(this, upIntent)) { // This activity is not part of the application's task, so create a new task // with a synthesized back stack. TaskStackBuilder.from(this) .addNextIntent(new Intent(this, MyGreatGrandParentActivity.class)) .addNextIntent(new Intent(this, MyGrandParentActivity.class)) .addNextIntent(upIntent) .startActivities(); finish(); } else { // This activity is part of the application's task, so simply // navigate up to the hierarchical parent activity. NavUtils.navigateUpTo(this, upIntent); } return true; } return super.onOptionsItemSelected(item); </code></pre> <p>}</p> <p>In my case I got 3 activities say A B and C, when user navigate from A to B I put some extras and <code>onCreate</code> of B I use that extras to query data from database to populate my rows and when I navigate back from C all extras are gone and Activity B show nothing.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload