I want to set different title for alert dialog when WebView
page is loaded but its not working.
here is the code snippet:
final AlertDialog.Builder alert = new AlertDialog.Builder(
mContext);
// alert.setTitle("Loading...");
final WebView wv = new WebView(mContext);
wv.loadUrl("http://10.0.51.133/androidview/");
wv.getSettings().setJavaScriptEnabled(true);
wv.setVerticalScrollBarEnabled(false);
WebViewClientLoader loader= new WebViewClientLoader(alert);
wv.setWebViewClient(loader);
wv.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
alert.setTitle("Loading...");
super.onPageFinished(view, url);
}
@Override
public void onPageStarted(WebView view, String url,
Bitmap favicon) {
// TODO Auto-generated method stub
alert.setTitle("Finished");
super.onPageStarted(view, url, favicon);
}
});
private class webviewclient extends WebViewClient{
}
wv.loadUrl("file:///android_asset/Like.html");
alert.setView(wv);
alert.show();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…