title: Load image in html string web view android?
body: <p>I want to load an image in <code>WebView</code> in android, and I have:</p>
  
  <pre><code>public static final String URL_EMOTION_2 = "/sdcard/kingfisher_ph/e2.gif";
  public static final String FILE = "file:/";
  // Get the image url
  String imagePath = FILE + URL_EMOTION_2;
  </code></pre>
  
  <p>If I use <code>webView.loadUrl(imagePath);</code> I can see the <code>e2.gif</code> loaded to screen. However, If I try to create an <code>Html String</code> and load to <code>WebView</code>:</p>
  
  <pre><code>String htmlString = "&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;img src=\"" + imagePath + "\" alt=\"My emotion\"/&gt;"&lt;/body&gt;&lt;/html&gt;";
  webView.loadData(htmlString, "text/html", "utf-8");
  </code></pre>
  
  <p>The code above cannot load image, it show only <code>My emotion</code> <code>String</code>! What's wrong with my code? Thanks everyone!</p>
  
  <p><b>Edit: </b> Thanks, I solved the problem above with <code>webView.loadDataWithBaseURL(...)</code>.</p>
  
  <p>However, I have one more problem that occur when I want to <code>reload</code> my <code>webView</code> (because sometimes, I want to change <code>htmlString</code> and reload <code>webView</code> to show what changed), it usually start a blank web page!! How can I disable it? Or is there any other ways to refresh the <code>webView</code>after I change the <code>htmlString</code> intermadiately?</p>