Android WebView - top ranked examples from Open Source projects

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

This code example shows how to use the following methods: loadUrl
	} 
	 
	/* Return Base64 Encoded String to Javascript */ 
	public void processPicture( String js_out )
	{		 
		mAppView.loadUrl("javascript:navigator.camera.win('" + js_out + "');");			
	} 
	 
	public void failPicture(String err)
	{ 
		mAppView.loadUrl("javascript:navigator.camera.fail('" + err + "');");
	} 
	 
} 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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);
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setId, setLayoutParams
    if ((row == null) || (row.findViewById(1337) == null)) {
      RelativeLayout layout = new RelativeLayout(activity);
      layout.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.FILL_PARENT, ListView.LayoutParams.WRAP_CONTENT));
      row = layout;
       
      WebView webView = new WebView(activity);
      webView.setId(1337);
      RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); 
      float scale = activity.getResources().getDisplayMetrics().density;
      boolean leftPadding = (parent.getTag().equals("right"));
      params.setMargins((int)(20 * scale) * (leftPadding ? 2 : 1), (int)(0 * scale), (int)(20 * scale), 0);
      webView.setLayoutParams(params);
      layout.addView(webView);
    } 
       
    WebView webView = (WebView)row.findViewById(1337);
 
    String item = (String)getItem(position);
    if (item.trim().length() == 0) {
      webView.loadData("<em>No information.</em>", "text/html", "utf-8");
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getSettings, loadUrl, setWebViewClient
		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);
			} 
 

10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: canGoBack, goBack
  } 
 
  @Override 
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
      if (webView.canGoBack()) {
        webView.goBack();
        return true; 
      } 
    } 
    return super.onKeyDown(keyCode, event);
  } 
 
  private final class HelpClient extends WebViewClient {
    @Override 
    public void onPageFinished(WebView view, String url) {
      setTitle(view.getTitle());
      backButton.setEnabled(view.canGoBack());
    } 
 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android WebView Questions & Answers:

Other Android WebView Examples

9:	public class DisPlayWebPageActivity extends Activity {
10:		
11:		WebView webview;
12:		
13:		@Override
-
19:			String page_url = in.getStringExtra("page_url");
20:			
21:			webview = (WebView) findViewById(R.id.webpage);
22:			webview.getSettings().setJavaScriptEnabled(true);
23:			webview.loadUrl(page_url);
-
37:		private class DisPlayWebPageActivityClient extends WebViewClient {
38:		    @Override
39:		    public boolean shouldOverrideUrlLoading(WebView view, String url) {
40:		        view.loadUrl(url);
41:		        return true;

Read More

See Code Examples for Android WebView Methods: