I am trying to display a png file using WebView.loadUrl(string) where the png file is stored inside the zip APK Expansion file in Android. The path to the Expansion file is:
Environment.getExternalStorageDirectory()+"/Android/obb/com.example.myapp/main.1.com.example.myapp.obb";
So I am using the following to display the file mypicture.png
String url = "jar:file:/" + Environment.getExternalStorageDirectory()+"/Android/obb/com.example.myapp/main.1.com.example.myapp.obb!/mypicture.png";
WebView wv;
... // code to setup the webview
wv.loadUrl(url);
I get the error Webpage not available at the link
jar:file://storage/sdcard0/Android/obb/com.example.myapp/main.1.com.example.myapp.obb!/mypicture.png
I know my expansion file is there and contains the png file because I have some test code to extract the png file from the expansion file. The wv.loadUrl(extracted_png_location) displays the png correctly when I point to the extracted png file outside. I just can't get it to display the png file that is inside the zip expansion file.
So the path to the png file inside the zip file must be wrong? Or is it even possible to use loadUrl() directly on a file inside the zip?