Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to load files from Android Assets folder in Webview

$
0
0

I am using Xamarin Forms 2.2.0.3, I am trying to access some .html and .js files from Android Assets folder and show them in Webview, but its not working for me.

I tried these two ways to achieve this:

  1. "file:///android_asset/MyFiles/main.html"

    But not getting the correct Url it seems

  2. AssetManager assets = Android.App.Application.Context.Assets;
    var asset = Android.App.Application.Context.Assets.Open ("MyFiles");

    this is also not working, and getting invalid path error.

If I am adding any files directly in Assets folder then I am able to read it but If I am adding it in some folder then its not working.

Can any one suggest me how to access files from folders in Assets folder in Xamarin Android?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>