How to rewrite a Canvas (reuse it)

i've got a method which draws an auto-generated set of lines onto a Canvas. This works without problems. Now the question is, how to add e.g. lines on this Canvas with the onTouch event. I try to solve this with a Thread and a SurfaceView, but then the Thread draws the auto-generated set infinitely. (The lines i want to add have to be deletable).

Any suggestions would be appreciated, thanks.

Answers


Put your lines coordinates in arraylist of line objects and use loop in your onDraw method iterate every line to draw it on canvas. Add lines in arraylist onTouch. After adding line onTouch call invalidate() to update canvas.


use

invalidate()

this will call

onDraw(Canvas canvas)

Need Your Help

Functional testing tools like Jameleon

c# .net functional-testing

Are there any functional testing tools like Jameleon (in java), available in the .net world?

Missing scrollbars even with overflow:scroll

html css scroll

I'm updating an existing intranet site that had previously been auto-generated by some software years ago. Needless to say the code was an absolute disaster. The client didn't want to change the ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.