Code example for WebView: Displaying web pages

Methods: loadUrlsetBackgroundColorsetScrollBarStylesetWebViewClient, setScrollbarFadingEnabled

0
		}); 
	} 
 
	public void generateNewRandomPic() { 
		/* WebViewClient must be set BEFORE calling loadUrl! */   
		randomPic.setWebViewClient(new WebViewClient() {  
			public void onPageFinished(WebView view, String url)  
			{   
				progBar.setVisibility(ProgressBar.GONE);
				loadText.setVisibility(TextView.GONE);
				randomPic.loadUrl("javascript:( function () { var resultSrc = document.getElementById(\"image\").getAttribute(\"src\"); window.HTMLOUT.appimageCallback(resultSrc); } ) ()");
			}   
		}); 
 
		randomPic.loadUrl("http://www.funcage.com/app-image.php");
		progBar.setVisibility(ProgressBar.VISIBLE);
		loadText.setVisibility(TextView.VISIBLE);
		//String imageURL = randomPic.loadUrl("javascript:PerformSimpleCalculation(document.getElementById(\"image\").getAttribute(\"src\"))"); 
		randomPic.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
		randomPic.setScrollbarFadingEnabled(false);
		randomPic.setBackgroundColor(0x00000000);
	} 
 
	public void getImageLocation() { 
		FuncageJavaScriptInterface getAppImageFile = new FuncageJavaScriptInterface();
		appImage = javaInterface.getAppImage();
Experience pair programming with AI  Get Codota for Java