Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

onclick - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...