05-09-2012 09:32 PM
Hello, my app has a screen where I override the save() method.
The new overriden method has a consistency check for an EditField to comtain at least 10 characters.
The problem happens when I escape the screen and get the save prompt:
If the EditField has less that 10 characters I get the Dialog.alert that is coded in my overriden save()
then if I push ok the applcation just exits without allowing me to correct the problem and without saving.
How can I make the app not to exit if the cosistency check is triggered?
public void save() {
String content = efldContent.getText();
if (content.length() >= 10) {
PersistentObject persistentObject;
final long KEY = 0xa12bb44cff71e9c1L;
persistentObject = PersistentStore.getPersistentObject(KEY);
persistentObject.setContents(new ControlledAccess(content));
persistentObject.commit();
}else{
Dialog.alert("content has to be at least 10 characters long");
}
}
How can I make the app not to exit if the cosistency check is triggered?
Thank you
Solved! Go to Solution.
05-10-2012 01:50 AM
The Dialog.alert is not suitable for this scenario.
You can use Dialog.ask or initiating a Dialog instance and use doModal to block your code and wait for the user response.
In both cases, you will get the selected index (or value) and you can continue according to the user selection.
E.
05-10-2012 01:55 AM
05-10-2012 02:54 AM
05-10-2012 09:41 PM
Thank you guys!