07-15-2010 02:42 AM
Hi i have a screen which has an edit field.
Now i make changes on this edit field.... and do my further processing.
Now i want to go back to my previous screen, so i press the back button, then it gives me a prompt as SAVE, DISCARD,CANCEL.
I dont want this prompt to come.
How can i disable it.
07-15-2010 02:49 AM
overwrite onsaveprompt to return false
07-15-2010 02:51 AM
refer this link:
07-15-2010 10:46 AM
If you want to go back using the back button you may want to overwrite the keyChar method and in it check if(ch == Characters.ESCAPE) and pop your current screen. This will work without disabling the prompt.
03-01-2011 12:10 AM
I found that this the flowchart on Victor Ewerts blog that explains screen saving flow very succinctly. I think overwriting isDirty is the simplest way to disable the prompt, it also retains the use of the escape button, which overwriting onSavePrompt does not.
public boolean isDirty() {
return false;
}
03-01-2011 02:05 PM
Another quick-and-dirty method is to use setDirty(false), but I do agree that overriding isDirty() is probably the more standard approach.
03-21-2012 01:53 AM