B. The view is null when calling findNavController()
C. The action ID does not exist in navigation graph
D. The fragment is not attached to activity
Solution
Step 1: Analyze navigation action ID
Using an invalid action ID not defined in navigation graph causes crash.
Step 2: Rule out other causes
Null view or fragment issues cause different errors; internet permission unrelated.
Final Answer:
The action ID does not exist in navigation graph -> Option C
Quick Check:
Invalid action ID crashes navigation [OK]
Hint: Check action IDs exist in navigation graph [OK]
Common Mistakes:
Assuming null view causes this specific crash
Blaming fragment attachment without evidence
Confusing permissions with navigation errors
5. You want to ensure users cannot go back to the login screen after successful login using navigation. Which approach manages this app flow correctly?
hard
A. Use popUpTo with inclusive=true to remove login from back stack
B. Call finish() on login fragment after navigation
C. Disable back button in the app globally
D. Navigate to login screen again after logout
Solution
Step 1: Understand back stack behavior
Navigation back stack keeps screens; to prevent back to login, remove it from stack.
Step 2: Use popUpTo with inclusive=true
This removes login screen from back stack, so back button skips it.
Step 3: Rule out other options
finish() is for activities, disabling back globally is bad UX, navigating again doesn't prevent back.
Final Answer:
Use popUpTo with inclusive=true to remove login from back stack -> Option A
Quick Check:
popUpTo inclusive=true manages back stack correctly [OK]
Hint: Use popUpTo inclusive=true to clear unwanted back screens [OK]
Common Mistakes:
Trying to finish fragments instead of managing back stack
Disabling back button breaks user experience
Navigating again doesn't remove previous screens
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.