Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you have a look at the <a href="http://developer.android.com/intl/de/reference/android/text/Html.html#fromHtml(java.lang.String)" rel="noreferrer">documentation for <code>Html.fromHtml(text)</code></a> you'll see it says:</p> <blockquote> <p>Any <code>&lt;img&gt;</code> tags in the HTML will display as a generic replacement image which your program can then go through and replace with real images.</p> </blockquote> <p>If you don't want to do this replacement yourself you can use <a href="http://developer.android.com/intl/de/reference/android/text/Html.html#fromHtml(java.lang.String,%20android.text.Html.ImageGetter,%20android.text.Html.TagHandler)" rel="noreferrer">the other <code>Html.fromHtml()</code> method</a> which takes an <a href="http://developer.android.com/intl/de/reference/android/text/Html.TagHandler.html" rel="noreferrer"><code>Html.TagHandler</code></a> and an <a href="http://developer.android.com/intl/de/reference/android/text/Html.ImageGetter.html" rel="noreferrer"><code>Html.ImageGetter</code></a> as arguments as well as the text to parse.</p> <p>In your case you could parse <code>null</code> as for the <code>Html.TagHandler</code> but you'd need to implement your own <code>Html.ImageGetter</code> as there isn't a default implementation. </p> <p>However, the problem you're going to have is that the <code>Html.ImageGetter</code> needs to run synchronously and if you're downloading images from the web you'll probably want to do that asynchronously. If you can add any images you want to display as resources in your application the your <code>ImageGetter</code> implementation becomes a lot simpler. You could get away with something like:</p> <pre><code>private class ImageGetter implements Html.ImageGetter { public Drawable getDrawable(String source) { int id; if (source.equals("stack.jpg")) { id = R.drawable.stack; } else if (source.equals("overflow.jpg")) { id = R.drawable.overflow; } else { return null; } Drawable d = getResources().getDrawable(id); d.setBounds(0,0,d.getIntrinsicWidth(),d.getIntrinsicHeight()); return d; } }; </code></pre> <p>You'd probably want to figure out something smarter for mapping source strings to resource IDs though.</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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