2

I try to implement CordovaWebView in an activity but I get the following Error:

android.view.InflateException: Binary XML file line #12: Error inflating class
org.apache.cordova.CordovaWebView

Here is my Code:

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

<!-- TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello" /-->

<org.apache.cordova.CordovaWebView
    android:id="@+id/tutorialView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

</LinearLayout>

and:

public class NewActivity extends Activity implements CordovaInterface {

CordovaWebView cwv;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    cwv = (CordovaWebView) findViewById(R.id.tutorialView);
    cwv.loadUrl("file:///android_asset/www/index.html");
}
}

My Phonegap version is 2.2.0 can anyone tell why it is happening?

thanks in advance

kobi

4

1 回答 1

2

尝试将其添加到您的主要活动课程中-

public Activity getActivity() {
      return this;
    }

参考:http: //3z.uipc.org/blog_wp/mixing-phonegap-webview-with-native-ui/

于 2013-02-08T03:32:31.660 回答