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.
tags. But cannot display image.
![\"bun\"]()
"; browserField.displayContent(str, "http://localhost"); I am using Blackberry OS 5.0 – user1134427 Sep 13 '12 at 10:15