ActivityNavArgsLazyKt

public final class ActivityNavArgsLazyKt


Summary

Public methods

static final @MainThread @NonNull NavArgsLazy<@NonNull Args>

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

Public methods

ActivityNavArgsLazyKt.navArgs

@MainThread
@NonNull
public static final @MainThread NavArgsLazy<@NonNull Args> <Args extends NavArgs> ActivityNavArgsLazyKt.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.