views:

893

answers:

1

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 = StaticFunctions.inputStreamToString(getAssets().open("ContentRoot/SubDir/file.html"));
mWebView.loadDataWithBaseURL("file:///android_asset/ContentRoot/SubDir/file.html", data, "text/html", "UTF-8", null);

The problem I'm having is that there are images in the HTML 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.

Why is it trying to load them from the wrong (relative) location and what can I do to correct the issue?

A: 

Oh man... I missed something stupid here. The html was just flat-out wrong and the Photos directory wasn't one level "up" from the source. Sorry for the confusion.

fiXedd