Best code examples for Android WebView class (android.webkit.WebView)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android WebView class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android WebView examples from Open Source projects
This code example shows how to use the following methods: loadUrl
26:	mAppView.loadUrl("javascript:navigator.camera.win('" + js_out + "');"); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: getContext, loadDataWithBaseURL, setBackgroundColor, setWebViewClient
146:	String source = getSource(wv.getContext()); 
-
149:	wv.setWebViewClient(this); 
-
152:	wv.loadDataWithBaseURL(null, html, "text/html", "utf-8", null); 
153:	wv.setBackgroundColor(color); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setId, setLayoutParams
189:	WebView webView = new WebView(activity); 
190:	webView.setId(1337); 
-
195:	webView.setLayoutParams(params); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getSettings, loadUrl, setWebViewClient
42:	WebView 	view 	 = new WebView(activity); 
43:	WebSettings settings = view.getSettings(); 
-
48:	view.setWebViewClient( new WebViewClient() { 
-
91:	view.loadUrl("http://www.dsploit.net/changelog.php"); 
Full Snippet Info
10
CodeRank
This code example shows how to use the following methods: canGoBack, goBack
151:	if (webView.canGoBack()) { 
152:	webView.goBack(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getSettings, restoreState, setWebViewClient
51:	browser.setWebViewClient(new RedirectFixer()); 
52:	browser.getSettings().setJavaScriptEnabled(true); 
-
55:	browser.restoreState(savedInstanceState); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: x 1
116:	mView.loadUrl("javascript:navigator.file.winCallback('File written')"); 
-
118:	mView.loadUrl("javascript:navigator.file.failCallback('Fail')"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: loadUrl
50:	mAppView.loadUrl("javascript:gotTemp(" + temp + ")"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getSettings, setWebViewClient
51:	view.setWebViewClient(new DefaultWebViewClient(getActivity())); 
52:	final WebSettings settings = view.getSettings(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: addJavascriptInterface
123:	gap = new PhoneGap(this, appView); 
124:	geo = new GeoBroker(appView, this); 
125:	accel = new AccelListener(this, appView); 
126:	launcher = new CameraLauncher(appView, this); 
127:	mContacts = new ContactManager(this, appView); 
128:	fs = new FileUtils(appView); 
129:	netMan = new NetworkManager(this, appView); 
130:	mCompass = new CompassListener(this, appView); 
-
133:	appView.addJavascriptInterface(gap, "DroidGap"); 
134:	appView.addJavascriptInterface(geo, "Geo"); 
135:	appView.addJavascriptInterface(accel, "Accel"); 
136:	appView.addJavascriptInterface(launcher, "GapCam"); 
137:	appView.addJavascriptInterface(mContacts, "ContactHook"); 
138:	appView.addJavascriptInterface(fs, "FileUtil"); 
139:	appView.addJavascriptInterface(netMan, "NetworkManager"); 
140:	appView.addJavascriptInterface(mCompass, "CompassHook"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: clearDisappearingChildren, clearFocus, clearCache, clearFormData, clearHistory
41:	webView.clearCache(true); 
42:	webView.clearHistory(); 
43:	webView.clearView(); 
44:	webView.clearSslPreferences(); 
45:	webView.clearDisappearingChildren(); 
46:	webView.clearFocus(); 
47:	webView.clearFormData(); 
48:	webView.clearMatches(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSettings
37:	super.applyWebSettings(view); 
38:	WebSettings settings = view.getSettings(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: loadUrl
31:	browser=new WebView(this); 
-
33:	browser.loadUrl(getIntent().getStringExtra(URL)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSettings, setWebChromeClient, setWebViewClient
77:	webView = new WebView(this); 
78:	webView.getSettings().setJavaScriptEnabled(true); 
79:	webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false); 
80:	webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL); 
-
84:	webView.setWebViewClient(webViewClient); 
85:	webView.setWebChromeClient(chromeClient); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSettings, loadUrl, reload, setWebViewClient
24:	WebView webView = new WebView(this); 
-
28:	webView.getSettings().setJavaScriptEnabled(true); 
29:	webView.setWebViewClient(new HelloWebViewClient()); 
30:	webView.reload(); 
-
32:	webView.loadUrl(url); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSettings, loadUrl, setWebChromeClient, setWebViewClient
25:	mWebView.setWebViewClient(new WebViewClient()); 
26:	mWebView.setWebChromeClient(new WebChromeClient()); 
27:	WebSettings settings = mWebView.getSettings(); 
-
37:	mWebView.loadUrl("http://developer.android.com"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSettings, setWebViewClient
76:	mWebView = new WebView(mActivity); 
-
78:	mUserAgent = mWebView.getSettings().getUserAgentString(); 
-
84:	WebViewTimersControl.getInstance().onBrowserActivityResume(mWebView); 
-
86:	mWebView.setWebViewClient(new WebViewClient() { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: canGoBack, goBack
108:	if (webView.canGoBack()) { 
109:	webView.goBack(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: post, getSettings, setWebViewClient
54:	webView.setWebViewClient(webClient); 
55:	WebSettings settings = webView.getSettings(); 
-
58:	webView.post(new Runnable() { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getSettings, loadUrl, setBackgroundColor
204:	WebView view = new WebView(this); 
205:	view.getSettings().setJavaScriptEnabled(true); 
206:	view.loadUrl("file:///android_asset/about.html"); 
207:	view.setBackgroundColor(Color.TRANSPARENT); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: loadUrl
52:	mAppView.loadUrl("javascript:gotBearing(" + heading + ")"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: post, getSettings, setWebViewClient
88:	WebSettings settings = webView.getSettings(); 
-
92:	webView.setWebViewClient(webClient); 
93:	webView.post(new Runnable() { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: canGoBack, canGoForward
183:	activity.setTitleButtonEnabled("back", mWebView.canGoBack()); 
184:	activity.setTitleButtonEnabled("forward", mWebView.canGoForward()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSettings
38:	super.applyWebSettings(view); 
39:	WebSettings settings = view.getSettings(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setVisibility, getSettings, loadUrl, setLayoutParams, setWebViewClient
202:	WebView webView = new WebView(this.getContext()); 
-
204:	webView.setWebViewClient(new AuthorizationWebViewClient()); 
-
206:	WebSettings webSettings = webView.getSettings(); 
-
209:	webView.loadUrl(this.requestUri.toString()); 
210:	webView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 
-
212:	webView.setVisibility(View.VISIBLE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getOriginalUrl, getSettings, getUrl
66:	mOriginalUrl = view.getOriginalUrl(); 
67:	mUrl = view.getUrl(); 
68:	mUserAgent = view.getSettings().getUserAgentString(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSettings, loadUrl
139:	WebView webView = new WebView(this); 
140:	webView.getSettings().setJavaScriptEnabled(true); 
141:	webView.getSettings().setBuiltInZoomControls(true); 
142:	webView.getSettings().setEnableSmoothTransition(true); 
-
144:	webView.getSettings().setUseWideViewPort(true); 
-
147:	webView.loadUrl(Summarizer.getDetailsUri().toString()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: clearCache, loadUrl, stopLoading
120:	webView.stopLoading(); 
-
122:	webView.clearCache(true); 
-
126:	webView.loadUrl(url); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSettings, loadUrl, setWebChromeClient, setWebViewClient
25:	webView = new WebView(this); 
-
34:	webView.getSettings().setJavaScriptEnabled(true); 
-
36:	webView.setWebChromeClient(new WebChromeClient() { 
-
42:	webView.setWebViewClient(new GoogleAuthWebViewClient()); 
-
44:	webView.loadUrl(AUTH_URL); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: loadUrl
49:	mAppView.loadUrl("javascript:gotAcceleration(" + x + ", " + y + "," + z + ")"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: loadUrl
23:	WebView webview = new WebView(this); 
-
27:	webview.loadUrl("file:///android_asset/help_page/" + filename); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setScrollbarFadingEnabled, getSettings, setMapTrackballToArrowKeys, setScrollBarStyle
53:	w.setScrollbarFadingEnabled(true); 
54:	w.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); 
55:	w.setMapTrackballToArrowKeys(false); // use trackball directly 
-
57:	w.getSettings().setBuiltInZoomControls(true); 
-
62:	w.getSettings().setDisplayZoomControls(!supportsMultiTouch); 
-
67:	s.startManagingSettings(w.getSettings()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: requestFocus, setOnTouchListener, getSettings, loadUrl, setWebViewClient
235:	final WebView wv = new WebView(context); 
-
265:	wv.getSettings().setJavaScriptEnabled(true); 
-
267:	wv.requestFocus(View.FOCUS_DOWN); 
268:	wv.setOnTouchListener(new View.OnTouchListener() { 
-
300:	wv.setWebViewClient(new WebViewClient() { 
-
351:	wv.loadUrl(startUrl); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: loadUrl
72:	mAppView.loadUrl("javascript:gotAccel(" + x +  ", " + y + "," + z + " )"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setScrollbarFadingEnabled, getSettings, setMapTrackballToArrowKeys, setScrollBarStyle
53:	w.setScrollbarFadingEnabled(true); 
54:	w.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); 
55:	w.setMapTrackballToArrowKeys(false); // use trackball directly 
-
57:	w.getSettings().setBuiltInZoomControls(true); 
-
62:	w.getSettings().setDisplayZoomControls(!supportsMultiTouch); 
-
67:	s.startManagingSettings(w.getSettings()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: addJavascriptInterface
101:	geo = new GeoBroker(appView, this); 
102:	accel = new AccelListener(this, appView); 
103:	launcher = new CameraLauncher(appView, this); 
104:	fs = new FileUtils(appView); 
-
107:	appView.addJavascriptInterface(gap, "DroidGap"); 
108:	appView.addJavascriptInterface(geo, "Geo"); 
109:	appView.addJavascriptInterface(accel, "Accel"); 
110:	appView.addJavascriptInterface(launcher, "GapCam"); 
111:	appView.addJavascriptInterface(fs, "FileUtil"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: canGoBack, goBack
192:	if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) { 
193:	mWebView.goBack(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: loadUrl
90:	mAppView.loadUrl("javascript:Device.setData('Android','" + version + "','" + this.getUuid() + "')"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setHorizontalScrollBarEnabled, setVerticalScrollBarEnabled, getSettings, setLayoutParams, setWebViewClient
35:	WebView webView = new WebView(GameActivity.getContext()); 
36:	webView.setVerticalScrollBarEnabled(false); 
37:	webView.setHorizontalScrollBarEnabled(false); 
38:	webView.setWebViewClient(new WebViewClient() { 
-
48:	WebSettings webSettings = webView.getSettings(); 
-
58:	webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: loadUrl
73:	WebView wv=new WebView(getContext()); 
-
75:	wv.loadUrl("http://commonsware.com"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: loadUrl
68:	browser.loadUrl(buf.toString()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: loadUrl
113:	browser.loadUrl(url); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: loadUrl
72:	wv.loadUrl(url); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: loadUrl
33:	view.loadUrl(url); 
Full Snippet Info
7
CodeRank
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: