2

What is the absolute path of the assets folder? I need it to reference some images saved in this folder from a html file saved in the memory device.

Alex
  • 6,957
  • 12
  • 42
  • 48

1 Answers1

2

To load an asset into an WebView the path would be

WebView webView = (WebView) findViewById(R.id...);
webView.loadUrl("file:///android_asset/xyz.html");

same would go for loading an image from assets into a WebView.

However, to my knowledge you can't load an asset from inside your apk in the devices default browser. To do this you'd first need to copy the asset from inside your apk into the phones memory.

Regexident
  • 29,441
  • 10
  • 93
  • 100
GeekYouUp
  • 1,651
  • 11
  • 10
  • How do I copy a image in phone memory? I know how to copy a file text in phone memory but to do it for a image is by a different way. – Alex Nov 09 '10 at 17:25
  • I have used context.openFileOutput() to copy a file text in memory. – Alex Nov 09 '10 at 17:26
  • There is some code in this post http://stackoverflow.com/questions/1986756/setting-ringtone-in-android for copying from the res/raw directory to sdcard, hopefully that is sufficient for your needs. – GeekYouUp Nov 10 '10 at 14:31