Interface PopGuard
public interface PopGuard
Intercept back/pop attempts on a Form. Install with Form#setPopGuard(PopGuard).
Typical use is to confirm before leaving a half-filled form, or to override hardware back to show a custom dialog.
Example
editForm.setPopGuard(new PopGuard() {
public boolean canPop(Form form, PopReason reason) {
if (!isDirty()) return true;
Dialog.show("Discard changes?", "You have unsaved edits.", "Stay", "Discard");
return false; // block the pop; we'll dismiss explicitly if user picks Discard.
}
});
-
Method Summary
-
Method Details
-
canPop
Decides whether a back/pop attempt should proceed.
Parameters
form: the form being popped.reason: what triggered the pop (back button, programmatic, etc.).
Returns
trueto let the navigation proceed,falseto block it. When blocking, the guard is responsible for any UI follow-up such as showing a confirm dialog and re-issuing the pop programmatically once confirmed.
-