问题
Hi i want to show html content in BrowserField. I used the code blove to do this but i only see white empty page.
BrowserField demo = new BrowserField();
String res="<html><body><p>demo</p></body></html>";
demo.displayContent(res, "http://localhost");
Sometimes it shows my page correctly with css fonts but sometimes it does not show anything.
What is the problem in my code?
回答1:
If you look at this BlackBerry example,
they make sure to add()
the BrowserField
to its parent Manager
before calling displayContent()
.
I don't know if you just omitted that line of code to shorten your question, if you're missing the call to add()
entirely, or if you put it after the call to displayContent()
. But, try doing it in the order listed in the BlackBerry example, and let me know if that works.
BrowserField demo = new BrowserField();
add(demo);
String res="<html><body><p>demo</p></body></html>";
demo.displayContent(res, "http://localhost");
来源:https://stackoverflow.com/questions/12578176/blackberry-browserfield-white-empty-page-issue