android-Implementing Descendant Navigation,Notifying the User

desaco發表於2016-01-31

 Descendant navigation is navigation down the application's information hierarchy. This is described inDesigning Effective Navigation and also covered inAndroid Design: Application Structure.

 Descendant navigation is usually implemented using Intentobjects and startActivity(), or by adding fragments to an activity using FragmentTransaction objects. This lesson covers other interesting cases that arise when implementing descendant navigation

 To prevent this from occurring, simply add the FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET flag to the intent used to launch the external activity, like so:

Intent externalActivityIntent = new Intent(Intent.ACTION_PICK);
externalActivityIntent.setType("image/*");
externalActivityIntent.addFlags(
        Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(externalActivityIntent);
 >Notifying the User

 A notification is a user interface element that you display outside your app's normal UI to indicate that an event has occurred. Users can choose to view the notification while using other apps and respond to it when it's convenient for them.

相關文章