public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.webviewactivity);
WebView webview=(WebView)findViewById(R.id.webViewActivityWebView);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebChromeClient(new WebChromeClient()
{
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
value=newProgress;
activity.setTitle("Loading..");
activity.setProgress(newProgress*100);
if(newProgress==100)
{
activity.setTitle(R.string.app_name);
}
}
});
webview.setWebViewClient(new WebViewClient(){
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
activity.setTitle("Error On Page");
}
public void onPageStarted(WebView view, String url, Bitmap favicon) {
loadDialog();
}
public void onPageFinished(WebView view, String url) {
progressDialog.dismiss();
}
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webview.loadUrl("http://www.google.com");
}
public void loadDialog()
{
progressDialog=ProgressDialog.show(this, "Loading", "Please Wait", true, true);
}