本文整理汇总了Java中android.webkit.WebView.destroy方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.destroy方法的具体用法?Java WebView.destroy怎么用?Java WebView.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.WebView
的用法示例。
在下文中一共展示了WebView.destroy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearWebView
import android.webkit.WebView; //导入方法依赖的package包/类
static final void clearWebView(WebView m) {
if (m == null)
return;
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;
}
示例2: hasWebView
import android.webkit.WebView; //导入方法依赖的package包/类
public static boolean hasWebView(Context context) {
if (mHasWebView != null) {
if (!mHasWebView)
SimplexToast.show(context, "Not WebView for you phone");
return mHasWebView;
}
try {
WebView webView = new WebView(context);
webView.destroy();
mHasWebView = true;
} catch (Exception e) {
e.printStackTrace();
mHasWebView = false;
SimplexToast.show(context, "Not WebView for you phone");
}
return mHasWebView;
}
示例3: hasWebView
import android.webkit.WebView; //导入方法依赖的package包/类
public static boolean hasWebView(Context context) {
if (mHasWebView != null) {
if (!mHasWebView) {
Toast.makeText(context, "Not WebView for you phone", Toast.LENGTH_SHORT).show();
}
return mHasWebView;
}
try {
WebView webView = new WebView(context);
webView.destroy();
mHasWebView = true;
} catch (Exception e) {
e.printStackTrace();
mHasWebView = false;
Toast.makeText(context, "Not WebView for you phone", Toast.LENGTH_SHORT).show();
}
return mHasWebView;
}
示例4: applyLocale
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void applyLocale() {
Context context = getContext();
final LocaleManager localeManager = LocaleManager.getInstance();
if (!localeManager.isMirroringSystemLocale(context)) {
final Locale currentLocale = localeManager.getCurrentLocale(context);
Locale.setDefault(currentLocale);
final Resources resources = context.getResources();
final Configuration config = resources.getConfiguration();
config.setLocale(currentLocale);
context.getResources().updateConfiguration(config, null);
}
// We create and destroy a new WebView here to force the internal state of WebView to know
// about the new language. See issue #666.
final WebView unneeded = new WebView(getContext());
unneeded.destroy();
}
示例5: onDestroy
import android.webkit.WebView; //导入方法依赖的package包/类
/** Called when the activity is finally destroyed or in portrait-landscape switch. */
@Override
public void onDestroy() {
// mhistoricalRecMgr.flush(); // shouldn't be done here because onDestroy is not called when switch to home screen and put smartmath background.
// release memory of wvOutput.
WebView wvOutput = (WebView) findViewById(R.id.webviewSmartMathOutput);
if (wvOutput != null) {
ViewGroup viewGroup = (ViewGroup) wvOutput.getParent();
if (viewGroup != null)
{
viewGroup.removeView(wvOutput);
}
wvOutput.setFocusable(true);
wvOutput.removeAllViews();
wvOutput.clearHistory();
wvOutput.destroy();
}
if (isFinishing()) {
MFPAdapter.clear();
}
try {
super.onDestroy();
} catch(Exception e) {
// have to add this for Amazon because at com.amazon.android.Kiwi.onDestroy(Unknown Source) it may throw exceptions.
}
if (isFinishing()) {
System.exit(0); // clear memory so that if adView get problem, it can really restart.
}
}
示例6: clearCache
import android.webkit.WebView; //导入方法依赖的package包/类
private void clearCache() {
WebView webView = new WebView(mActivity);
webView.clearCache(true);
webView.destroy();
Utils.showSnackbar(mActivity, R.string.message_cache_cleared);
}