Hi,
I'm trying to create MyWebView by extending WebView. My issue is that when I setup MyWebView in the layout resource (by changing an existing reference to WebView to MyWebView in main.xml), my code fails at setContentView(R.layout.main). My code works with WebView.
Any suggestions? I think the issue is using non-built-in classes in a layout.
public class MyWebView extends WebView {
public MyWebView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public MyWebView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyWebView(Context context) {
super(context);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<MyWebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
Within OnCreate for the initial Activity of the App I have:
private static MyWebView mWebView;
setContentView(R.layout.main); <-- FAILURE HERE
mWebView = (MyWebView) findViewById(R.id.webview);
Thanks!
Spencer


