Android WebSettings - 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 WebSettings class.

This code example shows how to use the following methods:setJavaScriptCanOpenWindowsAutomatically, setJavaScriptEnabled, setLayoutAlgorithm
         
        appView.setInitialScale(100);
        appView.setVerticalScrollBarEnabled(false);
         
        WebSettings settings = appView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
         
 
    	Package pack = this.getClass().getPackage();
    	String appPackage = pack.getName();
    	 
        WebViewReflect.setStorage(settings, true, "/data/data/" + appPackage + "/app_database/");
         
        /* Bind the appView object to the gap class methods */ 
        bindBrowser(appView);
         
        root.addView(appView);                   
        setContentView(root);                        
9
CodeRank
This code example shows how to use the following methods:setCacheMode, setDomStorageEnabled, setJavaScriptEnabled, setSaveFormData, setSavePassword
This code example shows how to use the following methods:setAppCacheEnabled, setDomStorageEnabled
 
    @Override 
    public void applyWebSettings(WebView view) {
        super.applyWebSettings(view);
        WebSettings settings = view.getSettings();
        settings.setAppCacheEnabled(true);
        settings.setDomStorageEnabled(true);
    } 
} 
8
CodeRank
This code example shows how to use the following methods:setDatabaseEnabled, setDatabasePath
 
    @Override 
    public void applyWebSettings(WebView view) {
        super.applyWebSettings(view);
        WebSettings settings = view.getSettings();
        settings.setDatabaseEnabled(true);
 
        Context context = view.getContext();
        String databasePath = context.getDir("database", Context.MODE_PRIVATE).getPath();
        settings.setDatabasePath(databasePath);
    } 
 
} 
7
CodeRank
This code example shows how to use the following methods:setAppCacheEnabled, setAppCacheMaxSize, setDatabasePath, setDomStorageEnabled, setGeolocationEnabled
	} 
 
	@SuppressLint("SetJavaScriptEnabled") 
	public void configureSetting(WebViewBridge webViewBridge) {
		WebSettings settings = webViewBridge.getSettings();
		settings.setJavaScriptEnabled(true);
		settings.setJavaScriptCanOpenWindowsAutomatically(true);
		settings.setGeolocationEnabled(true);
		settings.setDomStorageEnabled(true);
		File databasePath = new File(mContext.getCacheDir(), "webstorage");
		settings.setDatabasePath(databasePath.toString());
		settings.setAppCacheEnabled(true);
		settings.setAppCacheMaxSize(1024 * 1024 * 4);
	} 
 
	// for test 
	public void setInjectorHelper(InjectorHelper injectorHelper) {
		mInjectorHelper = injectorHelper;
	} 
 
7
CodeRank
This code example shows how to use the following methods:setJavaScriptEnabled, setLightTouchEnabled, setPluginsEnabled
		setWebView(); 
	} 
 
	public void setWebView() { 
		WebSettings settings = webView.getSettings();
		settings.setJavaScriptEnabled(true);
		settings.setPluginsEnabled(true);
		settings.setLightTouchEnabled(true);
		webView.setWebViewClient(webClient);
		webView.post(new Runnable() {
			public void run() { 
				if (CLEAR_CACHE_ON_LOAD) {
					webView.clearCache(true);
				} 
				webView.loadUrl(url);
			} 
		}); 
 
	} 
 
7
CodeRank
This code example shows how to use the following methods:setBuiltInZoomControls, setJavaScriptEnabled
	public void onActivityCreated(final Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		final WebView view = getWebView();
		view.setWebViewClient(new DefaultWebViewClient(getActivity()));
		final WebSettings settings = view.getSettings();
		settings.setBuiltInZoomControls(true);
		settings.setJavaScriptEnabled(true);
		WebSettingsAccessor.setAllowUniversalAccessFromFileURLs(settings, true);
	} 
 
	public static class DefaultWebViewClient extends WebViewClient {
 
		private final Activity mActivity;
		private final SharedPreferences mPreferences;
 
		public DefaultWebViewClient(final Activity activity) {
			mActivity = activity;
			mPreferences = activity.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
		} 
 
7
CodeRank
This code example shows how to use the following methods:setJavaScriptEnabled, setSaveFormData, setSavePassword, setSupportZoom
				return true; 
			} 
		}); 
		 
		WebSettings webSettings = webView.getSettings();
		webSettings.setSavePassword(false);
		webSettings.setSaveFormData(false);
		webSettings.setJavaScriptEnabled(true);
		webSettings.setSupportZoom(false);
		 
		NMEWebView.webView = webView;
		NMEWebView.view = NMEWebView.webView;
		 
		if(withPopup) {
			webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
			 
			ImageView closeImageView = new ImageView(GameActivity.getContext());
			closeImageView.setOnClickListener(new View.OnClickListener() {
				@Override 
				public void onClick(View v) {
7
CodeRank
This code example shows how to use the following methods:setBuiltInZoomControls
        super.applyWebSettings(view);
        WebSettings settings = view.getSettings();
        if (RhoConf.getBool("enable_screen_zoom")) { 
            settings.setBuiltInZoomControls(true);
        } else { 
            settings.setBuiltInZoomControls(false);
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:setBuiltInZoomControls, setJavaScriptEnabled, setLightTouchEnabled, setLoadWithOverviewMode, setLoadsImagesAutomatically

Related Android WebSettings Questions & Answers:

See Code Examples for Android WebSettings Methods: