Code example for Paint.FontMetricsInt

0
		Drawable mDrawable;
 
		public StickerSpan(Context context, Bitmap bitmap) {
			super(DynamicDrawableSpan.ALIGN_BASELINE);
			setBitmap(context, bitmap);
			mFontMetricsInt = new FontMetricsInt();
		} 
 
		public void setBitmap(Context context, Bitmap bitmap) {
			mDrawable = new BitmapDrawable(context.getResources(), bitmap);
			int width = mDrawable.getIntrinsicWidth();
	        int height = mDrawable.getIntrinsicHeight();
	        mDrawable.setBounds(0, 0, width > 0 ? width : 0, height > 0 ? height : 0); 
		} 
 
		@Override 
		public Drawable getDrawable() {
			return mDrawable;
		} 
 
Connect your IDE to all the code out there  Get Codota for Java