'Show image in textview using Html.fromhtml();
I have a list adapter to show content frm my social network, i need to put inside the text the img tags, i've tried using Html.fromhtml and it's formatting the text but instead of shows the img it shows a gray square.
How can i achieve that? I'v read about ImageGetter but i still don't have it very clear.
Thanks
Solution 1:[1]
String mIsi = (String) bundle.get("isi");
isi.setText(Html.fromHtml(mIsi, new Html.ImageGetter() {
@Override
public Drawable getDrawable(final String source) {
Picasso.get()
.load(source).into(imageView, new Callback() {
@Override
public void onSuccess() {
drawable = imageView.getDrawable();
drawable.setBounds(0, 0,
drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight());
}
@Override
public void onError(Exception e) {
Log.v("test pic","err"+e.getMessage());
}
});
imageView.setVisibility(View.GONE);
return drawable;
}
}, null));
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tri Mueri Sandes |