1

This is how we can resize a normal bitmap drawable

 Drawable d = getResources().getDrawable(R.drawable.error);
    Bitmap bm = ((BitmapDrawable)d).getBitmap();

    error_indicator = new BitmapDrawable(getResources(), bm.createScaledBitmap(bm, 50, 50, true));

But I want to know how to resize a nine patch drawable. since the above code doesnt works for me giving me ClassCastException saying NinePatchDrawable cannot be cast to BitmapDrawable. error drawable

This is nine-patch drawable(hdpi).I have other resolutions icons too

Draw 9-patch tool screenshot

enter image description here

App Screenshot

enter image description here

sanedroid
  • 1,036
  • 4
  • 16
  • 27

0 Answers0