overlay two images in android to set an imageview

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-04-29T18:55:42Z Indexed on 2010/04/29 18:57 UTC
Read the original article Hit count: 565

Filed under:
|

I am trying to overlay two images in my app, but they seem to crash at my canvas.setbitmap line. what am I doing wrong?

     private void test()
   {
       Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.t);
   Bitmap mBitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.tt);
   Bitmap bmOverlay = Bitmap.createBitmap(mBitmap.getWidth(), mBitmap.getHeight(), mBitmap.getConfig());
   Canvas canvas = new Canvas();
   canvas.setBitmap(bmOverlay);
   canvas.drawBitmap(mBitmap, new Matrix(), null);
   canvas.drawBitmap(mBitmap2, new Matrix(), null);
   testimage.setImageBitmap(bmOverlay);

   }

© Stack Overflow or respective owner

Related posts about android

Related posts about image