Cordova WebView attachment on Android

I use phonegap "2.0" with the Android SDK 15, I just want to implement Cordova WebView on an Android application, I used the Links guide step by step, also another example in github Links my application crashed and automatically stopped at startup. Logcat Error:

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

my xml file is "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 > 

thanks in advance..:)

+4
source share
1 answer

You may have the same error as mine. After I implemented the methods obtained 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 CordovaWebView most likely requires a corresponding Activity instance to initialize it.

Note. I am using Phonegap 2.1.0

+20
source

Source: https://habr.com/ru/post/1441599/


All Articles