In my application, when i am clicking i showing a dialog. and when i am pressing yes in that Dialog, it is giving me the illegal state exception. But i want to go back in the previous screen. If i am clicking menu and clicking close, then it is going back to the previous screen. Below is my code:
public boolean keyDown(int keycode, int time) {
if (Keypad.KEY_ESCAPE == Keypad.key(keycode)) {
int result = Dialog.ask(Dialog.D_YES_NO, "Do you want to edit the list?");
if (result == Dialog.YES)
{
try
{
UiApplication.getUiApplication().popScreen(this);
}
catch (Exception e)
{
e.printStackTrace();
}
// onClose();
}
else
{
return true;
}
} // end if
return false;
}
Please help..
When you are clicking the back button in the device then default onclose() method is called. So, try to do like this;
This is the better way; If you use like the above one then you may get one problem; That is:
Try this one;