Note that there are some explanatory texts on larger screens.

plurals
  1. POInline images with Text in android
    primarykey
    data
    text
    <p>I'm attempting to download webpages for a user to view later. So far, I've downloaded the html, and the images. I can get the HTML to show up nicely formatted, but I cannot get the images to inline.</p> <p>The code I'm using so far:</p> <p>This is my method to get the article.</p> <pre><code>MyImageGetter mig = new MyImageGetter(this, urlId); Spanned span = Html.fromHtml(contents[1], mig, null); contents[1] = span.toString(); titleView.setText(contents[0]); content.setText(contents[1]); </code></pre> <p>contents[] is an array that contains two strings. contents[0] is a simple string, contents[1] is a string with HTML markup.</p> <p>MyImageGetter:</p> <pre><code>public class MyImageGetter implements Html.ImageGetter{ String urlId = null; Context c = null; public MyImageGetter(ArticleViewer articleViewer, String urlId2) { c = articleViewer; urlId = urlId2; } public Drawable getDrawable(String source) { String[] brokenUrl = source.split("/"); String imgName = brokenUrl[brokenUrl.length-1]; File image = new File("/data/data/com.theHoloDev.Reader/Offline/" + urlId + "/" + imgName); Log.w("MyApp", image.getAbsolutePath()); Bitmap bm = BitmapFactory.decodeFile(image.getAbsolutePath()); Drawable d = new BitmapDrawable(c.getResources(), bm); return d; } } </code></pre> <p>When I have it log <code>image.getAbsolutePath()</code> it comes up with a file that exists in ddms. The Text content is there perfectly, but there are still little black boxes that say obj in each image. I had thought a textview would still be able to display images in that fashion, but either I'm doing something wrong, or there is another way to do this.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload