Open the website when the user clicks on the shortcut field on the BlackBerry

I want my BlackBerry app to open a website when I focus on its name.

Can anyone tell me how to do this?

+3
source share
1 answer
final LabelField label = new LabelField(url,LabelField.FOCUSABLE);
        label.setFocusListener(new FocusChangeListener(){
            public void focusChanged(Field field, int eventType) {
                if(eventType == FOCUS_GAINED){
                    BrowserSession bSession = Browser.getDefaultSession();
                    bSession.displayPage(label.getText());
                }

            }

        });
        add(label);
+6
source

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


All Articles