Skip to content Skip to sidebar Skip to footer

The Problem That The Safe Args's Argument Continues To Remain When Switching Screens

I use Navigation to switch screens. Move to B fragment on the A fragment screen of the bottom Write menu. Arguments are also passed while returning back using Safe Args from the mo

Solution 1:

The issue is not that the args are maintained. But since you are using activity view models, the data is persistent in the view model.

Use this,

args.workout.let { workout ->// here!! args is maintained..
    vm.addRoutine(workout)
}

The change is that we are not using safe calls(.?) anymore. Make necessary changes in addRoutine() to accept null values if they don't accept null.

Post a Comment for "The Problem That The Safe Args's Argument Continues To Remain When Switching Screens"