 drawable = mContext.getDrawable(mResourceId);
      drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
      return drawable;
 }
 }</pre>
 The class can be used like this:
 <pre>
 SpannableString string = new SpannableString("Text with a drawable span");
 string.setSpan(new MyDynamicDrawableSpan(context, R.mipmap.ic_launcher), 12, 20, Spanned
 .SPAN_EXCLUSIVE_EXCLUSIVE);</pre>
 <img src="https://developer.android.com/reference/android/images/text/style/dynamicdrawablespa