2016-01-10 85 views
3

我有2個問題:如何添加infiniteProgress到網頁瀏覽器

  1. 什麼webBrowserBrowserComponent之間的區別?

  2. 有什麼辦法,我可以添加一個infiniteProgresswebbrowser,該infiniteProgress會自動只在網頁瀏覽器完全加載處理。

回答

3

您可以使用類似

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 /處理此一會工夫。

WebBrowserBrowserComponent的更一般的專業化。舊設備不支持BrowserComponent API,而WebBrowser足夠智能,可以檢測並回退到舊的HTMLComponent API。

如果您僅針對現代智能手機,且未針對RIM設備,請直接使用BrowserComponent

+0

編輯答案以包含第二個問題的答案 –