salimido
salimido

Reputation: 151

Embedding Cordova WebView on Android

i'm using phonegap "2.0" with Android SDK 15, i just want to Embedding Cordova WebView on Android prject, i used step by step the guide Links, also another example in github Links my app crashed and stoped automatically when I run. Logcat error :

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

my xml file "main.xml":

<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent">
    <org.apache.cordova.CordovaWebView android:id="@+id/phoneGapView" android:layout_width="fill_parent" android:layout_height="fill_parent" />
</LinearLayout >

Thx in advance.. :)

Upvotes: 4

Views: 5617

Answers (1)

DonSteep
DonSteep

Reputation: 1075

You may have the same error as I did. Once I implemented the methods derived from CordovaInterface in my activity, in particular the getActivity method, the application started just fine.

@Override
public Activity getActivity() {
  return this;
}

Note that the default implementation returns null while the CordovaWebView most likely requires a proper Activity instance for its initialization.

Note: I am using PhoneGap 2.1.0

Upvotes: 20

Related Questions