Handle WebView inflate exceptions

Like:

android.view.InflateException: Binary XML file line #17: Error inflating class android.webkit.WebView
Caused by: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to find donor package: com.android.chrome
pull/147/head
M66B 6 years ago
parent d3919e2b5b
commit 43b63af4b9

@ -28,6 +28,7 @@ import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Base64;
import android.view.ContextMenu;
import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
@ -64,7 +65,15 @@ public class FragmentWebView extends FragmentBase {
@Override
@Nullable
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_webview, container, false);
View view = null;
try {
view = inflater.inflate(R.layout.fragment_webview, container, false);
} catch (InflateException ex) {
Toast.makeText(getContext(),
getString(R.string.title_no_viewer, Helper.formatThrowable(ex)),
Toast.LENGTH_LONG).show();
return null;
}
progressBar = view.findViewById(R.id.progressbar);
webview = view.findViewById(R.id.webview);

Loading…
Cancel
Save