How to close popup in blackberry bold

Hi, I have a pop-up screen when I click on a menu item

now I want to close this pop-up screen when the user presses the escape key key.but key. but it doesn’t work and remains stuck until I press a button on the pop-up screen.

how can i achieve this ???? filter - my popup screen is my code:

protected boolean keyChar(char c, int status, int time) { boolean retVal = false; if (c == Characters.ESCAPE) { close(); UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { //UiApplication.getUiApplication().popScreen(filter); UiApplication.getUiApplication(). popScreen(UiApplication.getUiApplication().getActiveScreen());//(filter); } }); retVal = super.keyChar(c,status,time); } return retVal; } 
+4
source share
1 answer

I need to override the keychar method in a popup screen, find escape and then close

the code:

  popupscreen1=new PopupScreen(myverticalfieldmanager) { protected boolean keyChar(char c, int status, int time) { if (c == Characters.ESCAPE) close(); return super.keyChar(c, status, time); } }; 
+9
source

Source: https://habr.com/ru/post/1305838/


All Articles