How to load html file stored on SD card in web view

I have an html file in the /mnt/sdcard/packagename/files/something.html path. Now I want to upload this file to webview.

When I surfed for this, I heard something about the content provider, but still haven't figured out how to do this.

Any answer?

Thanks in advance,

Tejaswi marakini

+4
source share
3 answers
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ Log.d(TAG, "No SDCARD"); } else { webComp.loadUrl("file://"+Environment.getExternalStorageDirectory()+"/packagename/files/something.html"); } 
+14
source

try the following:

 webview.loadUrl("file:///sdcard/packagename/files/something.html"); 
+3
source

Check here: http://www.anddev.org/read_a_txt_file_from_sd_card_in_a_real_device-t6619.html

The technique is the same for html. Downloading files from external storage has nothing to do with the content provider.

Hope this helps!

+1
source

All Articles