I'm using CordovaWebView in my android project. When I run application app load catch and show a blank toast message. and inside logcat i see an error that say file not exists in assets. I added jar file to libraries and added CordovaWebView inside my activity layout
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="11"
android:orientation="vertical" >
<org.apache.cordova.CordovaWebView
android:id="@+id/tutorialView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
and used this code for loading html file from assets :
CordovaWebView cwv;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_course);
try{
cwv = (CordovaWebView) findViewById(R.id.tutorialView);
cwv.loadUrlIntoView("file:///android_asset/test.html");
}
catch(Exception e)
{
ToastHelper.Long(e.getMessage());
}
}
html file exists in assets and I can load it using WebView (not CordovaWebView).
Please share with me your ideas to solving this problem.
Regards.
try to use
cwv.loadUrl("file:///android_asset/test.html");
instead of
cwv.loadUrlIntoView("file:///android_asset/test.html");
see this