NavUtils当中navigateUpTo和shouldUpRecreateTask

来源:互联网 发布:淘宝8.8元电影票教程 编辑:程序博客网 时间:2024/05/22 02:46

public static void navigateUpTo (Activity sourceActivity, Intent upIntent)

Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity in the process. upIntent will have the flag FLAG_ACTIVITY_CLEAR_TOP set by this method, along with any others required for proper up navigation as outlined in the Android Design Guide.

This method should be used when performing up navigation from within the same task as the destination. If up navigation should cross tasks in some cases, see shouldUpRecreateTask(Activity, Intent).

Parameters
sourceActivityThe current activity from which the user is attempting to navigate upupIntentAn intent representing the target destination for up navigation

public static boolean shouldUpRecreateTask (Activity sourceActivity, Intent targetIntent)

Returns true if sourceActivity should recreate the task when navigating 'up' by using targetIntent.

If this method returns false the app can trivially call navigateUpTo(Activity, Intent) using the same parameters to correctly perform up navigation. If this method returns false, the app should synthesize a new task stack by using TaskStackBuilder or another similar mechanism to perform up navigation.

Parameters
sourceActivityThe current activity from which the user is attempting to navigate uptargetIntentAn intent representing the target destination for up navigation
Returns
  • true if navigating up should recreate a new task stack, false if the same task should be used for the destination
0 0
原创粉丝点击