ActivityNavArgsLazyKt

Added in 1.0.0

public final class ActivityNavArgsLazyKt


Summary

Public methods

static final @NonNull NavArgsLazy<@NonNull Args>
@MainThread
<Args extends NavArgs> navArgs(@NonNull Activity receiver)

Returns a Lazy delegate to access the Activity's extras as an Args instance.

Public methods

@MainThread
public static final @NonNull NavArgsLazy<@NonNull Args> <Args extends NavArgs> navArgs(@NonNull Activity receiver)

Returns a Lazy delegate to access the Activity's extras as an Args instance.

It is strongly recommended that this method only be used when the Activity is started by androidx.navigation.NavController.navigate with the corresponding androidx.navigation.NavDirections object, which ensures that the required arguments are present.

class MyActivity : Activity() {
val args: MyActivityArgs by navArgs()
}

This property can be accessed only after the Activity is attached to the Application, and access prior to that will result in IllegalStateException.