Draw second bitmap on the first bitmap by method onDraw in Android studio

I created a customView class which exteds from View. In the method onDraw, I made a canvas and put the bitmap there, then I draw lines and circles on it. I called it in an other class in order to draw it. Now I need to draw other bitmap on the First Bitmap. When I make another canvas in onDraw and draw the new bitmap there, the application stops working.

      protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Canvas singleUseCanvas = new Canvas();//Canvas in order draw second bitmap
        canvas.drawBitmap(firstBitmap, 0, 0, new Paint());
        singleUseCanvas.drawBitmap(roomIconBitmap,100,100,iconPaint); // Second bitmap
         }

My question is: how can I draw a bitmap on an other bitmap by onDraw method? I hope that I could ask my question well. Thank you in advance!

链接地址: http://www.djcxy.com/p/67628.html

上一篇: 将Android视图作为位图获取以将其保存在SD上

下一篇: 在Android Studio中通过onDraw方法在第一个位图上绘制第二个位图