از اینترفیس ImageGetter استفاده کنید. به این صورت
public class HelpActivity extends Activity implements ImageGetter{
TextView message;
@SuppressLint("NewApi")
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);
message = (TextView) findViewById (R.id.TextViewMessage);
String html = "<b> hello world! </b> this is fisrt image <img src ='image1' /> and second image <img src='image2' >";
message.setText(Html.fromHtml(html, this, null));
message.setBackgroundColor(0x00000000);
}
@Override
public Drawable getDrawable(String source) {
// برای این مثال source برابر است با image1 و image2
int id = getResources().getIdentifier(source, "drawable", getPackageName());
Drawable d = getResources().getDrawable(id);
d.setBounds(0,0,d.getIntrinsicWidth(),d.getIntrins icHeight());
return d;
}
}