質問

I'm working with the BrowserFieldDemo (JDE 7.1.0) and on the event Event.EVENT_BROWSER_CONTENT_CHANGED, a BrowserContent object is retrieved with

(BrowserContent) browserContentChangedEvent.getSource();

My question is: can I get a BrowserField instance from the event information?

役に立ちましたか?

解決

I think the problem is that you're using the old BrowserFieldDemo. This code has been around for a long time (since way before 7.1), and uses code that's quite a bit more complex than what's been required since BB OS 5.0.

If you want to work directly with net.rim.device.api.browser.field2.BrowserField, then you should check out the BrowserField2Demo.

In Eclipse, goto BlackBerry -> Import -> BlackBerry Samples -> BrowserField2Demo.

If you then use the newer BrowserField, you can attach a BrowserFieldListener, which will get called back during normal browser events, similar to the method you mentioned from the old BrowserFieldDemo. In all those callbacks, you'll see that you do get passed a true instance of BrowserField, as you wanted.

 void documentAborted(BrowserField browserField, Document document) ;         
 void documentCreated(BrowserField browserField, ScriptEngine scriptEngine, Document document);             
 void documentError(BrowserField browserField, Document document);              
 void documentLoaded(BrowserField browserField, Document document);              
 void documentUnloading(BrowserField browserField, Document document);              
 void downloadProgress(BrowserField browserField, ContentReadEvent event);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top