I am loading a bitmap and then creating a new scaled version like this: Bitmap bm = BitmapFactory.decodeResource( getResources(), R.drawable.grid ); Matrix matrix = new Matrix(); matrix.postScale( (float) getSize() / bm.getWidth(), (float) getSize() / bm.getHeight() ); Bitmap b = Bitmap.createBitmap( bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true );
On Android 2.2 bm.getWidth() returns zero sometimes making my createBitmap() call raise the exception IllegalArgumentException: width and height must be > 0 I am not seeing it on any other Android version, just 2.2. My R.drawable.grid is a png with an alpha layer. I was reading about some problems others were having with Android decoding pngs but I couldn't find any cases with the width and height returning zero. Any idea how to fix? Thanks. -- Greg Donald -- 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