1

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?

Nate
  • 31,017
  • 13
  • 83
  • 207
user386093
  • 67
  • 8

1 Answers1

2

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);
Nate
  • 31,017
  • 13
  • 83
  • 207
  • Thanks Nate! I think you gave the right answer ~ although I was hoping I could just doing something in the old/simple BrowserFieldDemo. – user386093 Feb 28 '13 at 22:14
  • You're welcome. I think once you get used to it, you'll find that the new BrowserField (also known as browserfield2) is actually simpler to use. – Nate Feb 28 '13 at 22:23
  • I appreciate your input. Ok . . . I just did a build of the "BrowserField2Demo" supplied with JDE 7.1.0 and when I try to OTA load it onto my Torch 9850 it reports "Error 907 Invalid COD". Ouch! – user386093 Feb 28 '13 at 22:59
  • That's a separate problem. There are a few different reasons this could happen. I would recommend going to google and searching with the string: `blackberry Error 907 Invalid COD site:stackoverflow.com`, or maybe `site:blackberry.com`. Try the suggestions you find. If that doesn't work, post a new question. Thanks. (P.S. I would also certainly try installing your app via USB, rather than over the air, if that's a possibility.) – Nate Mar 01 '13 at 00:02