Blackberry 5.0 - 点击了 BrowserField 句柄链接 [英] Blackberry 5.0 - BrowserField handle link clicked

查看:15
本文介绍了Blackberry 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);

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆