2

アプリケーションのWebビューにローダーダイアログを追加しようとしています。それで、これを手伝ってくれませんか?

これは私のウェブビューコードです

public class AlTibbiWebViewActivity extends Activity {

private WebView wv;
private Intent incomingIntent = null;
private WebViewClient wvc = new WebViewClient() {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        wv.loadUrl(url);
        return true;
    }

};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.web_view);
    this.wv = (WebView) findViewById(R.id.webView);
    this.wv.setWebViewClient(wvc);
    wv.getSettings().setJavaScriptEnabled(true);
    this.incomingIntent = getIntent();
    String urlToLoad = incomingIntent.getExtras().getString("urlToLoad");

    //EXTRA HEADER MAP (remove header from web view )

     Map<String, String> aMap = new HashMap<String, String>() ;
     aMap.put("app", "no");
     //myMap = Collections.unmodifiableMap(aMap);
     wv.loadUrl(urlToLoad , aMap);

}
4

1 に答える 1

4
webView.setWebViewClient(new WebViewClient() {

        public boolean shouldOverrideUrlLoading(WebView view, String url) {              
            view.loadUrl(url);
            return true;
        }
        public void onLoadResource (WebView view, String url) {
            if (progrDialog == null) {
                progrDialog = new ProgressDialog(YourActivity.this);
                progrDialog.setMessage("Loading...");
                progrDialog.show();
            }
        }
        public void onPageFinished(WebView view, String url) {
            try{
            if (progrDialog.isShowing()) {
                progrDialog.dismiss();
                progrDialog = null;
            }
            }catch(Exception exception){
                exception.printStackTrace();
            }
        }
    }); 
于 2012-10-11T08:49:31.700 に答える