Try this
SpannableString string1=new SpannableString(yourdynamictext);
//Get Drawable
Drawable d=getResources().getDrawable(R.drawable.ic_launcher);
d.setBounds(0,0,d.getIntrinsicWidth(),d.getIntrinsicHeight());
// image span
ImageSpan span2= new ImageSpan(d,ImageSpan.ALIGN_BASELINE);
string1.setSpan(span2, 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
yourtextview.setText(string1);
Update:
set this for your textview
yourtexview.setMovementMethod(LinkMovementMethod.getInstance());
Use ClickableSpan
Here is the example
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View textView) {
Toast.makeText(MainActivity.this, "Hello",Toast.LENGTH_LONG).show();
}
};
string1.setSpan(clickableSpan , 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
yourtextview.setText(string1);