Question

Now i am doing one Puzzle. want to match the Correct Pair Via Dots. suppose if we connect mismatch pair it want to show alert as well as automatically remove that drawn lines. Now all functionalties are completed except one thing. i don't have any idea about remove drawn Line (automatically) .

Is it Possible in Android? Is there any method available to remove drawnline.

Was it helpful?

Solution

Are you drawing lines using Canvas.drawLine? There is no such thing in the api to "remove drawn line".

I can imagine a couple of options:

  • Draw the same line again using background color to "erase it"
  • Re-draw the whole screen again but without drawing lines this time

OTHER TIPS

As mentioned above there is no way to remove the drawn line. How ever you can do the following: 1) Make a copy of the original image(original image = img1; duplicate = img2), using Bitmap.copy. Copy it to Config.ARGB_8888 which makes it mutable. 2) Draw lines on the newly created image using canvas.drawLine() 3) When you want to go back to your old image without lines, display img1 and recycle img2.

However this works only if your image doesnt take up a lot of RAM, in which case you doing everything on the same image and downloading a new copy when you want to rollback would be the ideal option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top