Pick the fix
A form screen uses BackHandler(enabled = true) { showDiscardDialog() } and users can't see the back preview even with no changes. Fix?
Hint 1 of 1
When should the handler be active?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Set enabled = hasUnsavedChanges
Correct. With nothing to save, the system handles back and shows its preview.
Why not the others?
- B Override onBackPressed instead. Not called when targeting API 36.
- C Intercept KEYCODE_BACK. Breaks predictive back.
- D Remove the dialog entirely. Users could lose work.