gpt4 book ai didi

android - 内容捕捉器 : Failed to notify a WebView

转载 作者:行者123 更新时间:2023-11-29 02:27:37 25 4
gpt4 key购买 nike

我试图在我的 fragment 中打开一个 WebView 。但我收到了错误ContentCatcher:无法通知 WebView。

下面是我的 fragment 的 onCreateView 的代码

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_payment_gateway, container, false);


webView=(WebView)rootView.findViewById(R.id.paymentwebview);
WebSettings webSettings= webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
});
webView.loadUrl("www.google.com/");
return rootView;
}

fragment 布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/paymentwebview">

</WebView>
</LinearLayout>

日志是

07-13 17:59:48.410 14386-14386/com.clubtro.dev D/EgretLoader:   
EgretLoader(Context context)
07-13 17:59:48.411 14386-14386/com.clubtro.dev D/EgretLoader: The
context is not activity
07-13 17:59:48.423 14386-14386/com.clubtro.dev W/ContentCatcher:
Failed to notify a WebView

最佳答案

这只是一个警告,您可以忽略它

    @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View v=inflater.inflate(R.layout.fragment_bugtracker, container, false);
mWebView = (WebView) v.findViewById(R.id.webview);
mWebView.loadUrl("https://google.com");

// Enable Javascript
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);

// Force links and redirects to open in the WebView instead of in a browser
mWebView.setWebViewClient(new WebViewClient());

return v;
}

关于android - 内容捕捉器 : Failed to notify a WebView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51325459/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com