I want to display HTML tag in RIM BB component BrowserField.
String str ="<html><body><p><img alt=\"bun\" src=\"http://adodis.in/ram/services/images/stories/food/bun.jpg\" width=\"150\" height=\"112\" /></p></body></html>";
BrowserField browserField = new BrowserField();
browserField.displayContent(str, "http://localhost");
add(browserField);
How to display above tag in BrowserField? Using Blackberry OS 5.0
Thanks very much in advance..
If you run your app, and you see the label "bun"
displayed (the alt
text), then I think the problem is just that you don't have network connectivity. Check your network, especially if you're using the simulator (you can just run the Browser app and try a known URL).
If you are seeing nothing where the image should be, then I think the problem is just that you call displayContent()
before you add()
the BrowserField
to its parent manager.
So, just change the order of your calls, to call displayContent()
last:
BrowserField browserField = new BrowserField();
add(browserField);
String str ="<html><body><p><img alt=\"bun\" src=\"http://adodis.in/ram/services/images/stories/food/bun.jpg\" width=\"150\" height=\"112\" /></p></body></html>";
browserField.displayContent(str, "http://localhost");
Also, you don't really need to specify the img
width
and height
properties in your HTML snippet, as that's the size of the actual image file. But, that doesn't actually cause a problem ... it's just extra HTML code.