Jeremy Logan wrote:
> I have a WebView that I'm using to display some html/image files
> stored in the assets/ directory. I'm able to have the WebView load and
> html page fine with:
> 
> mWebView.loadUrl("file:///android_asset/ContentRoot/SubDir/
> file.html");
> 
> or
> 
> String data = inputStreamToString(getAssets().open("ContentRoot/SubDir/
> file.html"));
> mWebView.loadDataWithBaseURL("file:///android_asset/ContentRoot/",
> data, "text/html", "utf8", null);
> 
> The problem I'm having is that there are images in the HTML with
> relative URLs like:
> 
> <img src="../Photos/image.jpg" alt="whatever" />
> 
> and instead of loading from assets/ContentRoot/Photos/image.jpg it's
> trying to load them from assets/Photos/image.jpg.

Well, in your second scenario, it's loading them from where you told it.
Try making your base URL file:///android_asset/ContentRoot/foo.html.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Development Wiki: http://wiki.andmob.org

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to