On 02/13/2012 05:51 AM, Jim Graham wrote:
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.

why don't you just go into debug mode and see where the bmp goes null?

--
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