本文介绍了黑莓5.0 - BrowserField手柄点击链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想处理 BrowserField 事件,当用户实际点击的链接。
我研究了 BrowserFieldListener ,其试图 documentCreated()的方法,但在页面开始加载,给我一个答复。我希望有一个触发的时刻用户点击里面browserField的链接。

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.

我缺少的是在这里吗?

推荐答案

覆盖handleNavigationRequest() ProtocolController像

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

这篇关于黑莓5.0 - BrowserField手柄点击链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 09:43