android get the drawable that has sett as drawabletop of textview

android, textview

Solution

Use

 Drawable[] drawables = textView.getCompoundDrawables();

Also if you want to compare two drawable.

Bitmap bitmap = ((BitmapDrawable)drawables[1] ).getBitmap();
Bitmap bitmap2 = ((BitmapDrawable)getResources().getDrawable(R.drawable.twt_hover)).getBitmap();

if(bitmap == bitmap2)
    {
        //Code blcok
    }

Problem

i have textview ``` <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dip" android:drawableTop="@drawable/new" /> ``` and i want on activity jave to know which image has set on `drawableTop`, how ?

Original source

Related problems