I found an idea here: Using an AssetManager for resource loading at run time
How can I implement it? Kindly could somebody help me with more information?
Thanks in advance.
I found an idea here: Using an AssetManager for resource loading at run time
How can I implement it? Kindly could somebody help me with more information?
Thanks in advance.
Ex: Place your text file in the /Assets ... /Assets/example.txt
public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
InputStream input = Assets.Open ("my_asset.txt");
}
}
Or you can also put the file in the /Resources/raw... /Resources/raw/example
InputStream is = getResources().openRawResource(R.raw.example);
Or you can load html from asset and load in webview:
webview.loadUrl("file:///asset/aboutcertified.html");
Additionally, some Android functions will automatically load asset files:
/Assets/fonts/samplefont.ttf
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
For more information: https://developer.android.com/reference/android/content/res/AssetManager.html