I am working on an application where I have to implement Add and edit functionality. I am using a fragment to which I am passing a safearg which works fine for the edit mode as I pass the args but it crashes for the add mode as this time I do not pass any arguments. Is it possible to not to pass argument based on condition?
Asked
Active
Viewed 109 times
0
-
Can you include your navigation graph in your question (specifically, the destination you're going to and the `
` that go to it)? – ianhanniballake Jul 04 '20 at 23:34
1 Answers
0
Add a null value for the argument. Then in edit and add screen, check if null. If value is null, then it is an Add. If not null, then it is an edit.

Mervin Hemaraju
- 1,921
- 2
- 22
- 71