Please help me with exception.

I have single resources folder. /res/drawable

I create a custom button from one of the resource with some color
effect.

This works for ldpi, hdpi, xdpi devices, but when I run an app on the
mdpi device it crashes.


My code:

Bitmap b1 = BitmapFactory.decodeResource(context.getResources(),
drawableResourceId);
                if (b1 == null) {
                        return null;
                }
                Paint p = new Paint();
                p.setAntiAlias(true);
                p.setAlpha(150);

                byte[] chunk = b1.getNinePatchChunk();

                Bitmap b2 = Bitmap.createBitmap(b1.getWidth(), b1.getHeight(),
b1.getConfig());  // this line fails,

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to