Can any one help me out how to use Html.ImageGetter to dispaly images using html image src tag ? and example or good tutorial
I'm not sure about this. but, it looks that we implement code for downloading image. HttpClient is good for downloading image and it works well. But the problem is that After I create Drawable from downloaded file and return it. However EditText doesn't show the image. BTW, I've got almost same problem like you above. If you got a solution, please share it with me. Thanks in advance.
textView.setText(Html.fromHtml(htmlToSetAsText, new ImageGetter() { @Override public Drawable getDrawable(String source) { String path = "/sdcard/" + source; Drawable bmp = Drawable.createFromPath(path); bmp.setBounds(0, 0, bmp.getIntrinsicWidth(), bmp.getIntrinsicHeight()); return bmp; } }, null));
Drawable bmp = Drawable.createFromPath(path);
This line returns null.. what's the problem with this line ?...
The answer from kape123 certainly helped me. I was so nearly there.
The bit that's easy to miss is the call to setBounds on the Drawable. The Html.ImageGetter help documentation also provides a clue when it says:
Make sure you call setBounds() on your Drawable if it doesn't already have its bounds set.