java.lang.Object | |
↳ | android.support.v4.app.NavUtils |
NavUtils provides helper functionality for applications implementing recommended Android UI navigation patterns. For information about recommended navigation patterns see Tasks and Back Stack from the developer guide and Navigation from the design guide.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | PARENT_ACTIVITY |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Obtain an
Intent that will launch an explicit target activity
specified by sourceActivityClass's PARENT_ACTIVITY <meta-data>
element in the application's manifest. | |||||||||||
Obtain an
Intent that will launch an explicit target activity
specified by sourceActivityClass's PARENT_ACTIVITY <meta-data>
element in the application's manifest. | |||||||||||
Obtain an
Intent that will launch an explicit target activity
specified by sourceActivity's PARENT_ACTIVITY <meta-data>
element in the application's manifest. | |||||||||||
Return the fully qualified class name of sourceActivity's parent activity as specified by
a
PARENT_ACTIVITY <meta-data> element within the activity element in
the application's manifest. | |||||||||||
Return the fully qualified class name of a source activity's parent activity as specified by
a
PARENT_ACTIVITY <meta-data> element within the activity element in
the application's manifest. | |||||||||||
Convenience method that is equivalent to calling
. | |||||||||||
Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity
in the process.
| |||||||||||
Returns true if sourceActivity should recreate the task when navigating 'up'
by using targetIntent.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Obtain an Intent
that will launch an explicit target activity
specified by sourceActivityClass's PARENT_ACTIVITY
<meta-data>
element in the application's manifest.
context | Context for looking up the activity component for sourceActivityClass |
---|---|
sourceActivityClass | Class object for an Activity class |
PackageManager.NameNotFoundException | if the ComponentName for sourceActivityClass is invalid |
---|
Obtain an Intent
that will launch an explicit target activity
specified by sourceActivityClass's PARENT_ACTIVITY
<meta-data>
element in the application's manifest.
context | Context for looking up the activity component for the source activity |
---|---|
componentName | ComponentName for the source Activity |
PackageManager.NameNotFoundException | if the ComponentName for sourceActivityClass is invalid |
---|
Obtain an Intent
that will launch an explicit target activity
specified by sourceActivity's PARENT_ACTIVITY
<meta-data>
element in the application's manifest. If the device is running
Jellybean or newer, the android:parentActivityName attribute will be preferred
if it is present.
sourceActivity | Activity to fetch a parent intent for |
---|
Return the fully qualified class name of sourceActivity's parent activity as specified by
a PARENT_ACTIVITY
<meta-data> element within the activity element in
the application's manifest.
sourceActivity | Activity to fetch a parent class name for |
---|
Return the fully qualified class name of a source activity's parent activity as specified by
a PARENT_ACTIVITY
<meta-data> element within the activity element in
the application's manifest. The source activity is provided by componentName.
context | Context for looking up the activity component for the source activity |
---|---|
componentName | ComponentName for the source Activity |
Convenience method that is equivalent to calling
.
sourceActivity will be finished by this call.
navigateUpTo
(sourceActivity,
getParentActivityIntent
(sourceActivity))
Note: This method should only be used when sourceActivity and the corresponding
parent are within the same task. If up navigation should cross tasks in some cases, see
shouldUpRecreateTask(Activity, Intent)
.
sourceActivity | The current activity from which the user is attempting to navigate up |
---|
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)
.
sourceActivity | The current activity from which the user is attempting to navigate up |
---|---|
upIntent | An intent representing the target destination for up navigation |
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.
sourceActivity | The current activity from which the user is attempting to navigate up |
---|---|
targetIntent | An intent representing the target destination for up navigation |