3

I'm new to Android. I'm making action bar with Up navigation. I see the tutorial referring to "NavUtils.navigateUpFromSameTask(this)" call in onOptionsItemSelected. But I see I don't need this code. The default operation from Android is OK, it navigates to the parent activity already.

Why do I need this code? Could you give me an explanation? Thank you.

vietstone
  • 8,784
  • 16
  • 52
  • 79
  • follow this link:http://stackoverflow.com/questions/18941355/how-does-navutils-navigateupfromsametask-work – prakash Sep 24 '14 at 04:08
  • This method, it finishes the current activity and starts (or resumes) the appropriate parent activity. For example: If your application is not in recent searches and application opened from notification. Now, on click of notification you're opening activity. Now if you press back application close. to avoid closing and to open some main activity this method is used. Check more details: http://developer.android.com/training/implementing-navigation/ancestral.html – Harsha Vardhan Sep 24 '14 at 04:56

0 Answers0