質問

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top