title: Android: cannot load image to webview from internal storage
body: <p>For my android app I want to load a html file to webview, this html file will be stored in "data/data/com.myapp/files/index.html". I am able to load it with the associated javascript files but when I want to load the image from "data/data/com.myapp/files/img/image.png" it doesn't work.
  This is how i'm trying to do it:</p>
  
  <pre><code>webView.loadDataWithBaseURL(getFilesDir()+"/img/", html, "text/html","utf-8", ""); //html is my html string I get from index.html
  </code></pre>
  
  <p>I've also tried:</p>
  
  <pre><code>webView.loadUrl(getFilesDir()+"/img/"+index.html");
  </code></pre>
  
  <p>In my html file i have </p>
  
  <pre><code> &lt;img id="image" src="/img/image.png"/&gt;
  </code></pre>
  
  <p>I've verified and the file is loaded on the disk but i can't display it on webview, the display stays blank for image. I just can't make it work. So my question is: is it even possible? If yes can someone please tell me how?</p>
  
  <p>I've searched and found that others had similar problems but none of the solutions is working. </p>
  
  <p>EDIT: Putting my files in asset directorty is not an option for me, which i've already tested and it works. </p>
  
  <p>I just tried the following code I found here: <a href="https://stackoverflow.com/questions/5051364/load-the-image-saved-in-sdcard-in-webview">Load the image saved in sdcard in webview</a> </p>
  
  <pre><code>String base = getFilesDir(); 
  String imagePath = base + "/test.jpg"; 
  String html = ("&lt;html&gt;
              &lt;head&gt;
              &lt;/head&gt;
              &lt;body&gt;
              &lt;img src=\""+ imagePath + "\"&gt;
              &lt;/body&gt;
              &lt;/html&gt;
              "); 
  mWebView.loadData(html, "text/html","utf-8");
  </code></pre>
  
  <p>But still no success, apparently it worked for the person who asked the question. I've also tested with the external storage but the result is same. All permissions are there in manifest.xml. So I really don't see what the problem is. Any suggestion or advice will be appreciated.</p>