Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blackberry 5.0 - BrowserField handle link clicked

I am trying to handle an event in BrowserField when the user actually clicks a link. I studied BrowserFieldListener, tried its documentCreated() method but that gives me a response when the page starts loading. I want a trigger the moment user clicks a link inside browserField.

What am i missing here?

like image 791
Jazib Avatar asked Jan 16 '23 20:01

Jazib


1 Answers

Override handleNavigationRequest() of ProtocolController like

ProtocolController controller = new ProtocolController(browserField) {
    public void handleNavigationRequest(BrowserFieldRequest request) throws Exception {
         /* 
         Here you get the redirection link using 
           request.getURL() 
         and do what you want to do 
          */
      // to display url in browserfield use
      InputConnection inputConnection = handleResourceRequest(request);
      browserField.displayContent(inputConnection, request.getURL()); 

    }
};

browserField.getConfig().setProperty(BrowserFieldConfig.CONTROLLER, controller);
like image 82
Ajmal M A Avatar answered Jan 30 '23 20:01

Ajmal M A