Code example for WebView: Displaying web pages

Methods: getSettingsloadUrlsetWebViewClient

9
		super(activity);
 
		this.setTitle("Changelog");
 
		 
		WebView 	view 	 = new WebView(activity);
		WebSettings settings = view.getSettings();  
         
		settings.setJavaScriptEnabled(true);  
		settings.setAppCacheEnabled(false);
         
		view.setWebViewClient( new WebViewClient() {
			@Override 
			public void onPageStarted( WebView view, String url, Bitmap favicon ) {
				if( mLoader == null )
					mLoader = ProgressDialog.show( activity, "", "Loading changelog ..." );
				 
				super.onPageStarted(view, url, favicon);
			} 
 
			@Override 
			public void onPageFinished( WebView view, String url ) {
				super.onPageFinished(view, url);
				mLoader.dismiss();
			} 
 
			@Override 
			public void onReceivedError( WebView view, int errorCode, String description, String failingUrl ) {
				try  
				{ 
					mLoader.dismiss();
				}  
				catch( Exception e ) { }
				 
				try  
				{ 
					view.stopLoading();
			    }  
				catch( Exception e ) { }
			     
				try  
			    { 
					view.clearView();
			    }  
				catch( Exception e ) { }
 
				view.loadData( ERROR_HTML.replace( "{DESCRIPTION}", description ), "text/html", "UTF-8" );
				 
				super.onReceivedError(view, errorCode, description, failingUrl);
			} 
		}); 
		 
		this.setView(view);
	 
		view.loadUrl("http://www.dsploit.net/changelog.php");
 
		this.setCancelable(false);
		this.setButton("Ok", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
				dialog.dismiss();