WebView loadDataWithBaseURL - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for WebView loadDataWithBaseURL method.

This code example shows how to use the following methods:getContext, loadDataWithBaseURL, setBackgroundColor, setWebViewClient
	} 
	 
	 
    private void setup(){ 
    	 
    	String source = getSource(wv.getContext());
    	String html = source.replace("@src", url).replace("@color", Integer.toHexString(color));
    	 
    	wv.setWebViewClient(this);
    	 
    	//wv.setInitialScale(100); 
    	wv.loadDataWithBaseURL(null, html, "text/html", "utf-8", null);
    	wv.setBackgroundColor(color);
    	 
    } 
	 
    private void done(WebView view){
    	if(progress != null){
			//progress.setVisibility(View.GONE); 
			view.setVisibility(View.VISIBLE);
8
CodeRank
This code example shows how to use the following methods:loadDataWithBaseURL, setBackgroundColor, setScrollBarStyle
	 * @param context 
	 * @param html 
	 */ 
	public static void showHtml(final Context context, final String html) {
		AlertDialog.Builder moreDetailsDialog = null;
		final WebView webView = new WebView(context);
		final ScrollView scrollView = new ScrollView(context);
 
		webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
		webView.setBackgroundColor(Color.WHITE);
		webView.loadDataWithBaseURL("fake://not/needed", html, "text/html", "UTF-8", null); // Encoding
																							// fix 
																							// for 
																							// Android 
																							// 3.x 
																							// / 
																							// 4.x 
		scrollView.addView(webView);
 
		moreDetailsDialog = new AlertDialog.Builder(context);
6
CodeRank
This code example shows how to use the following methods:getContext, loadDataWithBaseURL, setBackgroundColor, setWebViewClient
	} 
	 
	 
    private void setup(){ 
    	 
    	String source = getSource(wv.getContext());
    	String html = source.replace("@src", url).replace("@color", Integer.toHexString(color));
    	 
    	wv.setWebViewClient(this);
    	 
    	//wv.setInitialScale(100); 
    	wv.loadDataWithBaseURL(null, html, "text/html", "utf-8", null);
    	wv.setBackgroundColor(color);
    	 
    } 
	 
    private void done(WebView view){
    	if(progress != null){
			//progress.setVisibility(View.GONE); 
			view.setVisibility(View.VISIBLE);
6
CodeRank
This code example shows how to use the following methods:layout, getSettings, loadDataWithBaseURL, setWebViewClient
     legendLayoutparams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
     legendLayoutparams.setMargins(15, 15, 0, 0);
     legendLayout.setLayoutParams(legendLayoutparams);
      
     // now create the webview itself, and add to legendView 
     WebView webView = new WebView(activity);
     webView.getSettings().setJavaScriptEnabled(true);
     // force to open any URLs in native browser instead of WebView  
     webView.setWebViewClient(new WebViewClient() {
           @Override 
           public boolean shouldOverrideUrlLoading(WebView view, String url) {
              return super.shouldOverrideUrlLoading(view, url);
           } 
       }); 
     webView.layout(0, 0, 320, 300);
     webView.loadDataWithBaseURL("file:///android_asset/",HTML_HEAD+html+HTML_FOOT, "text/html", "UTF-8",null);
     legendLayout.addView(webView);
      
     mainLayout.addView(legendLayout);
 } 
} 
8
CodeRank
This code example shows how to use the following methods:setVisibility, loadDataWithBaseURL
	 
	public static void setWebPage(WebView wv, WebPage wp){
		 
		try{ 
			 
			wv.setVisibility(View.VISIBLE);
			 
			AQUtility.debug("load", wp.getUrl());
			wv.loadDataWithBaseURL(wp.getUrl(), wp.getHtml(), "text/html", "utf-8", null);
			 
		}catch(Exception e){
			AQUtility.report(e);
		} 
	} 
	 
	private static void setReady(ImageView imageView, WebPage wp){
    	 
		if(imageView == null || !wp.getOriginal().equals(imageView.getTag(AQuery.TAG_URL))){
			return; 
		} 
6
CodeRank
This code example shows how to use the following methods:getSettings, loadDataWithBaseURL, setLayoutParams, setView
7
CodeRank
This code example shows how to use the following methods:setVisibility, getSettings, loadDataWithBaseURL
	} 
	public static String getCalibPath() {
		return appFolder + "camera.yml";
	} 
    public static void displayImageInWebView(WebView myWebView, String imagePath){
		myWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
		myWebView.getSettings().setBuiltInZoomControls(true);
		myWebView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
		myWebView.setVisibility(View.VISIBLE);
		 
		// HTML is used to display the image. 
		String html =   "<body bgcolor=\"White\">" +
						//"<p>" +  + "</p>" + 
						"<center> <img src=\"file:///" + 
						imagePath +
						// Appending the time stamp to the filename is a hack to prevent caching. 
						"?" + new Date().getTime() + 
						"\" width=\"500\" > </center></body>"; 
		        
		myWebView.loadDataWithBaseURL("file:///unnecessairy/",

6
CodeRank
This code example shows how to use the following methods:addJavascriptInterface, getSettings, loadDataWithBaseURL, setWebChromeClient
	 * @param context The Android context of the program. This is needed to instantiate the WebView 
	 * @param gaeChannelApiSource This is the path to the Channel API Javascript source on your GAE server. 
	 * (e.g. http://myGaeApp.appspot.com/_ah/channel/jsapi) 
	 */ 
	public ChannelAPI(Context context, String gaeChannelApiSource) {
		mWebView 		= new WebView(context);
		mJsInterface 	= new ChannelAPIJavaScriptInterface();
		mChannelClosed 	= true;
		mLogging 		= false;
		 
		WebSettings webSettings = mWebView.getSettings();
		webSettings.setSavePassword(false);
		webSettings.setSaveFormData(false);
		webSettings.setSupportZoom(false);
		webSettings.setJavaScriptEnabled(true);
		 
		mWebView.setWebChromeClient(new ChannelAPIWebChromeClient());
		mWebView.addJavascriptInterface(mJsInterface, "channelAPI");
		mWebView.loadDataWithBaseURL(null, CHANNEL_API_JAVASCRIPT_START + gaeChannelApiSource + CHANNEL_API_JAVASCRIPT_END, "text/html", "utf-8", null);
		 

5
CodeRank
This code example shows how to use the following methods:getSettings, loadDataWithBaseURL, setWebViewClient
This code example shows how to use the following methods:loadDataWithBaseURL, setBackgroundColor
  } 
   
  private void addRow(String iString, String fString, String sString){
    TableRow row = new TableRow(this.getActivity());
     
    WebView icon = new WebView(this.getActivity());
    if (iString == null){
      icon.loadDataWithBaseURL("", DEFAULT_ICON_SRC, mimeType, encoding, null); 
    } else if (iString == "titleBar"){
      // leave it null for the title 
    } else { 
      icon.loadDataWithBaseURL("", iString, mimeType, encoding, null);
    } 
    icon.setBackgroundColor(0x00000000);
    TextView friend = new TextView(this.getActivity());
    friend.setText(fString);
    friend.setTextColor(Color.WHITE);
     
    TextView status = new TextView(this.getActivity());
    status.setText(sString);
5
CodeRank

Related WebView loadDataWithBaseURL Questions & Answers:

loadDataWithBaseURL Method Overview
Loads the given data into this WebView, using baseUrl as the base URL for the content.
See Code Examples for other Android WebView Methods: