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.
}
});
Methods
public abstract boolean canPop(Form form, PopReason reason) | Decides whether a back/pop attempt should proceed. |
Method details
canPop
public abstract boolean canPop(Form form, PopReason reason)Decides whether a back/pop attempt should proceed.
Parameters
formForm- the form being popped.
reasonPopReason- what triggered the pop (back button, programmatic, etc.).
Returns
true to let the navigation proceed, false to 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.