I have tried to create a webview with JavaScript, but I get the error:
'Cannot cast View from WebView' on the line WebView myWebView = (WebView) findViewById(R.id.mainWebView);
This is the full code
package com.CalvaryChapelMelbourne.CCM;
import android.app.Activity;
import android.webkit.WebSettings;
public class WebView extends Activity {
WebView webview;
public WebView() {
WebView myWebView = (WebView) findViewById(R.id.mainWebView);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
}
}
XML Layout:
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/mainWebView"/>