On Dec 13, 2011, at 3:49 PM, Steven Pack wrote:
>> The Android docs and samples have the following for loading local html:
>> 
>> var webView = new WebView (this);
>> this.SetContentView (webView);
>>                      
>> webView.LoadUrl ("file://android_asset/index.html");
>> 
>> Not suprisingly, I get the error that the file does not exist.

To make this work, you need to do two things:

1. Use three slashes, not two:

        webView.LoadUrl ("file:///android_assets/index.html");

2. Add the file Assets\index.html to your project, and set its Build action to 
AndroidAsset.

See also:

        http://developer.android.com/resources/articles/using-webviews.html
        
http://code.google.com/p/apps-for-android/source/browse/trunk/Samples/WebViewDemo/src/com/google/android/webviewdemo/WebViewDemo.java#51
        
http://developer.android.com/reference/android/webkit/WebSettings.html#setAllowFileAccess(boolean)

Thanks,
 - Jon

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to