Google se compromete a impulsar la igualdad racial para las comunidades afrodescendientes. Obtén información al respecto.

NavUtils

class NavUtils
kotlin.Any
   ↳ androidx.core.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.

Summary

Constants
static String

Public methods
static Intent?
getParentActivityIntent(@NonNull sourceActivity: Activity)

Obtain an Intent that will launch an explicit target activity specified by sourceActivity's PARENT_ACTIVITY <meta-data> element in the application's manifest.

static Intent?
getParentActivityIntent(@NonNull context: Context, @NonNull sourceActivityClass: Class<*>)

Obtain an Intent that will launch an explicit target activity specified by sourceActivityClass's PARENT_ACTIVITY <meta-data> element in the application's manifest.

static Intent?
getParentActivityIntent(@NonNull context: Context, @NonNull componentName: ComponentName)

Obtain an Intent that will launch an explicit target activity specified by sourceActivityClass's PARENT_ACTIVITY <meta-data> element in the application's manifest.

static String?
getParentActivityName(@NonNull sourceActivity: Activity)

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.

static String?
getParentActivityName(@NonNull context: Context, @NonNull componentName: ComponentName)

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.

static Unit
navigateUpFromSameTask(@NonNull sourceActivity: Activity)

Convenience method that is equivalent to calling navigateUpTo(sourceActivity, getParentActivityIntent (sourceActivity)).

static Unit
navigateUpTo(@NonNull sourceActivity: Activity, @NonNull upIntent: Intent)

Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity in the process.

static Boolean
shouldUpRecreateTask(@NonNull sourceActivity: Activity, @NonNull targetIntent: Intent)

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

Constants

PARENT_ACTIVITY

static val PARENT_ACTIVITY: String
Value: "android.support.PARENT_ACTIVITY"

Public methods

getParentActivityIntent

@Nullable static fun getParentActivityIntent(@NonNull sourceActivity: Activity): Intent?

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.

Parameters
sourceActivity Activity: Activity to fetch a parent intent for
Return
Intent? a new Intent targeting the defined parent activity of sourceActivity

getParentActivityIntent

@Nullable static fun getParentActivityIntent(
    @NonNull context: Context,
    @NonNull sourceActivityClass: Class<*>
): Intent?

Obtain an Intent that will launch an explicit target activity specified by sourceActivityClass's PARENT_ACTIVITY <meta-data> element in the application's manifest.

Parameters
context Context: Context for looking up the activity component for sourceActivityClass
sourceActivityClass Class<*>: java.lang.Class object for an Activity class
Return
Intent? a new Intent targeting the defined parent activity of sourceActivity
Exceptions
NameNotFoundException if the ComponentName for sourceActivityClass is invalid

getParentActivityIntent

@Nullable static fun getParentActivityIntent(
    @NonNull context: Context,
    @NonNull componentName: ComponentName
): Intent?

Obtain an Intent that will launch an explicit target activity specified by sourceActivityClass's PARENT_ACTIVITY <meta-data> element in the application's manifest.

Parameters
context Context: Context for looking up the activity component for the source activity
componentName ComponentName: ComponentName for the source Activity
Return
Intent? a new Intent targeting the defined parent activity of sourceActivity
Exceptions