如何将无限进度添加到网络浏览器
how to add infiniteProgress to a webbrowser
我有两个问题:
webBrowser
和BrowserComponent
有什么区别?
有什么方法可以在webbrowser
中添加一个infiniteProgress
,infiniteProgress
只有在浏览器完全加载时才会自动释放。
你可以使用像
这样的东西
InfiniteProgress prog = new InfiniteProgress();
final Dialog dlg = prog.showInifiniteBlocking();
final WebBrowser wb = findLoginWebBrowser();
((BrowserComponent) wb.getInternal()).setBrowserNavigationCallback(
new BrowserNavigationCallback() {
public boolean shouldNavigate(String url) {
//your condition
if(xyz){
Display.getInstance().callSerially(new Runnable() {
public void run() {
//do whatever you wants
dlg.dispose();
}
});
}
}
}
);
但是当你知道你是什么 URL 时,这个就会起作用 passing/processing。
WebBrowser
是 BrowserComponent
的更通用的专业化。旧设备不支持 BrowserComponent
API,而 WebBrowser
足够智能,可以检测到并回退到旧的 HTMLComponent
API。
如果您只针对现代智能手机而不针对 RIM 设备,请直接使用 BrowserComponent
。
我有两个问题:
webBrowser
和BrowserComponent
有什么区别?有什么方法可以在
webbrowser
中添加一个infiniteProgress
,infiniteProgress
只有在浏览器完全加载时才会自动释放。
你可以使用像
这样的东西InfiniteProgress prog = new InfiniteProgress();
final Dialog dlg = prog.showInifiniteBlocking();
final WebBrowser wb = findLoginWebBrowser();
((BrowserComponent) wb.getInternal()).setBrowserNavigationCallback(
new BrowserNavigationCallback() {
public boolean shouldNavigate(String url) {
//your condition
if(xyz){
Display.getInstance().callSerially(new Runnable() {
public void run() {
//do whatever you wants
dlg.dispose();
}
});
}
}
}
);
但是当你知道你是什么 URL 时,这个就会起作用 passing/processing。
WebBrowser
是 BrowserComponent
的更通用的专业化。旧设备不支持 BrowserComponent
API,而 WebBrowser
足够智能,可以检测到并回退到旧的 HTMLComponent
API。
如果您只针对现代智能手机而不针对 RIM 设备,请直接使用 BrowserComponent
。