1

Running webview in android in the app

The error is an EGL_BAD_DISPLAY. There have been a few references to the issues such as here and here, but these have not been useful so far (these have included adding transparent background (see the .java) and hardware acceleration (see .xml). Internet permission is enabled in the manifest.

I am debugging on a physical device, android version 5.0.2, Samsung tablet Tab 4.

Debug error log

10-19 16:32:58.757 28363-28363/? E/Zygote: MountEmulatedStorage()
10-19 16:32:58.757 28363-28363/? E/Zygote: v2
10-19 16:32:58.767 28363-28363/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
10-19 16:33:03.267 28363-28657/com.amazon.mysampleapp E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)

.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_demo_home);

    WebView myWebView = (WebView) findViewById(R.id.webview);
    myWebView.setBackgroundColor(0x00000000);
    myWebView.getSettings().setJavaScriptEnabled(true);
    myWebView.setWebViewClient(new WebViewClient());
    myWebView.loadUrl("file:///android_asset/MyMap8.html");
    myWebView.setBackgroundColor(0x00000000);

    // Other AWS gibberish

.xml

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


    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="500dp"
        >

    <ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@android:id/list"
        />
</LinearLayout>
Community
  • 1
  • 1
Iorek
  • 571
  • 1
  • 13
  • 31

1 Answers1

-3

Solution was to use WebChromeClient (import android.webkit.WebChromeClient;) rather than WebViewClient

Iorek
  • 571
  • 1
  • 13
  • 31