Search code examples
blackberryjava-me

Add on-click event code to a LabelField


In my application there is a LabelField with text "www.google.com" When the user clicks, the default browser should open to www.google.com.


Solution

  • try this code

    final LabelField label = new LabelField("http://www.google.com",LabelField.FOCUSABLE){
                public boolean navigationClick (int status , int time){
                     BrowserSession bSession = Browser.getDefaultSession();
                     bSession.displayPage(label.getText());
                     return true;
                }
            };