Let's see: 2048 *  1536 * Bitmap.Config.ARGB_8888 = 12 megabytes.

I'd guess that you are running into a memory allocation failure.

-- Kostya

13 февраля 2012 г. 8:51 пользователь Jim Graham <[email protected]> написал:
> Background:  what I'm trying to do here is create a bitmap with only one color
> at a set alpha channel value (making the bitmap somewhat transparent) for
> the entire bitmap.  Unfortunately, when the new bitmap (bmp) is passed to
> an imageView, it's NULL (according to logcat).
>
> The following code is from my app, and the error is somewhere in here:
>
>   Bitmap bmp = Bitmap.createBitmap(2048, 1536, Bitmap.Config.ARGB_8888);
>   Canvas mcanvas = new Canvas(bmp);
>   Paint paint = new Paint();
>   mcanvas.drawBitmap(bmp, 0, 0, paint);
>   paint.setARGB(10,28,0,0);
>   Matrix matrix = new Matrix();
>   matrix.setValues(new float[] {
>   1, 0, 0,
>   0, 1, 0,
>   0, 0, 1
>   });
>   mcanvas.drawBitmap(bmp, matrix, paint);
>
>   imageView.setImageBitmap(bmp);  // bmp is NULL ---> FORCE CLOSE
>
> Can anyone help me spot where I went wrong?  I've been digging through
> Bitmap, Bitmap.Config, Paint, Canvas, imageView, example SDK code, and
> the book I'm working from, and am not seeing it.
>
> Thanks,
>   --jim
>
> --
> THE SCORE:  ME:  2  CANCER:  0
> 73 DE N5IAL (/4)            MiSTie #49997      < Running FreeBSD 7.0 >
> [email protected]                    ICBM/Hurr.: 30.44406N 86.59909W
>
>   "Now what *you* need is a proper pint of porter poured in a proper
>   pewter porter pot.."     --Peter Dalgaard in alt.sysadmin.recovery
>
> Android Apps Listing at http://www.jstrack.org/barcodes.html
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Reply via email to