0

I am developing an Android Games. I have created a canvas on screen. I want to show an object for 2 second on its screen and then it should be disappear.

How can I achieve this?

Toon Krijthe
  • 52,876
  • 38
  • 145
  • 202
user1602798
  • 365
  • 3
  • 5
  • 13

2 Answers2

0

Use this code to remove your canvas object

Paint paint = new Paint();
paint.setXfermode(new PorterDuffXfermode(Mode.CLEAR));
canvas.drawPaint(paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC));

else

Canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR)
Shalini
  • 1,733
  • 4
  • 17
  • 31
0

Keep 2 copies of bitmap. On 2nd dont draw the object and draw this 2 bitmaps alternatively, or look into this will help you

Community
  • 1
  • 1
Vishal Pawar
  • 4,324
  • 4
  • 28
  • 54