List of usage examples for android.webkit WebView setTag
public void setTag(final Object tag)
From source file:com.just.agentweb.AgentWebUtils.java
static final void clearWebView(WebView m) { if (m == null) { return;//from ww w. j a v a2 s.c om } if (Looper.myLooper() != Looper.getMainLooper()) { return; } m.loadUrl("about:blank"); m.stopLoading(); if (m.getHandler() != null) { m.getHandler().removeCallbacksAndMessages(null); } m.removeAllViews(); ViewGroup mViewGroup = null; if ((mViewGroup = ((ViewGroup) m.getParent())) != null) { mViewGroup.removeView(m); } m.setWebChromeClient(null); m.setWebViewClient(null); m.setTag(null); m.clearHistory(); m.destroy(); m = null; }
From source file:info.alni.comete.android.Comete.java
private AlertDialog createHelpDialog() { final WebView wv = new WebView(this); wv.setTag("help"); wv.getSettings().setJavaScriptEnabled(true); wv.setWebViewClient(internalWebViewClient); wv.loadUrl(URL_HELP_MAIN);/*from w w w .ja va 2 s .com*/ return new AlertDialog.Builder(this).setTitle("Help").setView(wv) .setPositiveButton("Close", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); }
From source file:com.juick.android.Utils.java
public static void setupWebView(final WebView wv, String content) { try {//from ww w. ja v a 2 s .com if (skipWeb) return; SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(wv.getContext()); File file = new File(wv.getContext().getCacheDir(), "temp.html"); String PREFIX = "#prefs.checked."; while (true) { int ix = content.indexOf(PREFIX); if (ix == -1) break; int ix2 = content.indexOf("#", ix + 1); if (ix2 == -1) break; String key = content.substring(ix + PREFIX.length(), ix2); boolean def = false; if (key.endsWith("!")) { def = true; key = key.substring(0, key.length() - 1); } boolean checked = sp.getBoolean(key, def); content = content.substring(0, ix) + (checked ? "checked" : "") + content.substring(ix2 + 1); } FileWriter fileWriter = new FileWriter(file); fileWriter.write(content); fileWriter.close(); wv.getSettings().setJavaScriptEnabled(true); // wv.getSettings().setBlockNetworkImage(false); // wv.getSettings().setBlockNetworkLoads(false); wv.getSettings().setLoadsImagesAutomatically(true); Uri uri = Uri.fromFile(file); wv.addJavascriptInterface(new Object() { public void onFormData(String str) { wv.setTag(str); } }, "EXT"); wv.loadUrl(uri.toString()); } catch (IOException e) { // } }
From source file:com.ubiLive.GameCloud.Browser.WebBrowser.java
/** * release the webview url/* w w w .j av a 2 s . co m*/ */ public void reload(String reloadUrl) { if (!sBCurrentActivityStatus) { return; } DebugLog.d(TAG, "0829 reload() enter"); int size = mChildViewList.size(); if (size > 1) { for (int i = 0; i < (size - 1); i++) { WebView child = (WebView) mChildViewList.get(i).findViewById(GameActivityRes.ID_CHILD_WEBVIEW); if (child.getTag() != null) { child.loadUrl(child.getTag().toString()); child.setTag(null); } else { child.reload(); } } } // String reloadUrl = Utils.checkUrl(GameInfo.DEFAULT_URL); mWebView.loadUrl(reloadUrl); }