I want to be able to display some simple chunks of HTML in my native BlackBerry app, NOT returned from a URL. This is similar to existing Stackoverflow questions (e.g. here and here), but I need help getting the actual BlackBerry sample code to run (or perhaps somebody to tell me why this is doomed to not work!).
The BlackBerry website has some sample 'browser' code based on different API versions available:
V4.5 API sample
V5.0 API sample
I've found the sample code that ships with the Component Packs (more info here), and tried to get the V4.5 sample code to work. I was hoping this would be a useful starting point...
I've managed to get BrowserFieldDemo to compile in Eclipse and run in the Simulator (I needed to comment out the whole of BrowserContentManagerDemo.java otherwise that class would run instead).
Unfortunately, I just get a white screen in the Simulator. When I add in logging and use the debugger, it all seems to go wrong at the getBrowserContent() line here:
BrowserContent browserContent = null;
try
{
browserContent = _renderingSession.getBrowserContent(connection, this, e);
<snip>
}
catch (RenderingException re)
{
EventLogger.logEvent(ID, (re + "").getBytes(), EventLogger.ERROR);
System.err.println(re);
}
The Exception returned is:
net.rim.device.api.browser.field.RenderingException: IOException in connection
I've tried building and using the Simulator with the 4.5.0 and 4.7.0 Component Packs, but they both have the same symptoms.
If I push the samples.cod file to my device and start it, I get "Error starting samples: Module 'samples' attempts to access a secure API". Presumably I would need to sign the sample code with my code signing keys (which I do have), which I am not sure how to do in Eclipse.
So, my questions are:
1) Has anybody actually got this V4.5 sample code working? Should I give up on the Simulator and use the device instead?
2) Can this V4.5 approach work for displaying some simple HTML data that I have? e.g. can I use a localhost URL, or perhaps create a custom HttpConnection to serve up the data?
I need to support BlackBerry models running V4.5, V4.7 and V5.0, if at all possible.
Any tips would be appreciated!