title: Showing image in WebView from External storage Directory on device
body: <p>I want to show an image in a webview which has been downloaded externally to <code>ExternalStorageDirectory</code>. I am using the followng code to load the HTML as a string with the base URL set to be that of where the images are saved:</p>
  
  <pre><code>Article article = page.articles.get(0);
  
  String mime = "text/html";
  String encoding = "utf-8";
  
  String base = "file:/" + Environment.getExternalStorageDirectory() + "/images_folder/";
  Log.v("IMAGE", base);
  
  webView = (WebView)rootView.findViewById(R.id.webView);
  webView.setBackgroundColor(Color.TRANSPARENT);
  webView.loadDataWithBaseURL(base, article.articleContent, mime, encoding, null);
  </code></pre>
  
  <p>This code works fine in the emulator but when I try it on a device (Nexus 7 Tablet) the image doesn't load. The image is definitely stored in the External Storage Directory as they can be found using a file explorer on the tablet. I imagine this has something to do with the Nexus 7 using emulated storage but I really don't know, the call <code>Environment.getExternalStorageDirectory()</code> should point to the same directory every time.</p>
  
  <p>The html String being brought in is very simple and looks like this:</p>
  
  <pre><code>&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;img src = 'test_download1.png'&gt;&lt;/img&gt;This is the first Article for the first page in html&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Where <code>test_download1.png</code> is a file stored in the External Storage directory.</p>