Some Android system apps, such as the official Contacts edit screen, have introduced a behavior which is that exiting an edit screen using the back or up buttons is equivalent of saying "OK" and triggers the changes to be saved. To cancel changes, one actually needs to open the overflow menu and select "Delete changes".
Since this is done in an official app, I feel like it is the new way to go and try to implement it in my current project.
Therefore, I am stuck in the case in which I have a form that allows editing a certain type of data. There are cases in which the form cannot be accepted (such as if some fields have invalid values) and others that require confirmation from the user (such as removing a sub-item of the data that will affect other parts of the application).
Documentation is missing on that subject...
When encountering such cases, should I show a confirmation dialog as the user is pressing the Back button? This seems necessary but awkward to me, as it would block the user from going back as desired. Or should I put a save button somewhere in the UI and keep the back button for cancel?
If applying such principles, that would give :
Invalid fields scenario
1st back press : a dialog tells the user that the form contains invalid values.
2nd back press (on the dialog) : the activity containing the form is dismissed, changes are discarded.
Critical changes scenario
1st back press : a dialog tells the user that a designated change in the form contents is about to have destructive consequences, and gives a chance to cancel. Or it requests the choice of a policy to propagate such changes.
2nd back press : the activity containing the form is dismissed, changes are discarded.