Closed GoogleCodeExporter closed 9 years ago
Btw, this is j2me
Original comment by jkoo...@gmail.com
on 19 Apr 2012 at 12:13
You need to follow events in the HTMLComponent to see that loading completed
and only then start on something new.
Yes the code should block against that misuse but it doesn't and fixing it will
probably break allot more.
Original comment by shai.almog
on 19 Apr 2012 at 12:31
Wow nice tip man thanks! :)
Here's the solution:
protected void startApp() throws MIDletStateChangeException {
Display.init(this);
Display.getInstance().callSeriallyAndWait(new Runnable() {
public void run() {
browser = new WebBrowser();
Object browserInternal = browser.getInternal();
if (browserInternal instanceof HTMLComponent) {
HTMLComponent htmlComponent = (HTMLComponent) browserInternal;
htmlComponent.setIgnoreCSS(false);
htmlComponent.setEventsEnabled(true);
htmlComponent.setRequestHandler(new MyDefaultDocumentRequestHandler());
}
Form f = new Form();
f.setLayout(new GridLayout(1, 1));
f.addComponent(browser);
f.show();
browser.setPage("<html><head></head><body>Go fish!</body></html>", null);
}});
Object browserInternal = browser.getInternal();
if (browserInternal instanceof HTMLComponent) {
HTMLComponent htmlComponent = (HTMLComponent) browserInternal;
while (htmlComponent.getPageStatus() != HTMLCallback.STATUS_COMPLETED) {
System.out.println("" + htmlComponent.getPageStatus());
Bozza.sleep(20);
}
}
Display.getInstance().callSeriallyAndWait(new Runnable() {
public void run() {
browser.setPage("<html><head></head><body>Oh man!</body></html>", null);
}
});
}
Original comment by jkoo...@gmail.com
on 19 Apr 2012 at 12:50
even better,
if (htmlComponent.getPageStatus() >= HTMLCallback.STATUS_REQUESTED) {
while (htmlComponent.getPageStatus() != HTMLCallback.STATUS_COMPLETED) {
System.out.println("" + htmlComponent.getPageStatus());
Bozza.sleep(20);
}
}
Original comment by jkoo...@gmail.com
on 19 Apr 2012 at 12:57
Closing since this is inherent in HTMLComponent and has a working process.
Original comment by shai.almog
on 22 Nov 2013 at 9:12
Original issue reported on code.google.com by
jkoo...@gmail.com
on 19 Apr 2012 at 12:12