Skip to content Skip to sidebar Skip to footer

Webview Causing Errors On Second Activity

I have the following code which works fine when I have it in my main Activity: WebView webView = (WebView)findViewById(R.id.iQuestionWebView); webView.loadDataWithBaseURL(n

Solution 1:

Here's how I solved this issue, although I only test my apps on a device (the simulator is too slow).

  1. In the manifest file, add the internet permission:

    uses-permission android:name="android.permission.INTERNET"
  2. In your webview (so in Quiz.java), you need to enable javascript:

    webView.getSettings().setJavaScriptEnabled(true);
    

In my case, these 2 things get rid of the problem and display the content (youtube video in my case) in the webview in the device.

Post a Comment for "Webview Causing Errors On Second Activity"