I am new to the Android Graphics class. I want to draw an image(actually a signature kind) using the touch events and want it to be saved on SDcard when I want to save it. I have scanned through the web for any such tutorials but I have not found any. Can anyone please tell me how to draw on canvas using the touch events and save it.
Any tutorials or sample code will be of great help.
I saw really good code on android developers, but I can’t find it anymore… It’s output is bezier curves so it will be pretty smooth. Here is code that I edited:
then in onCreate of activity you want to use it in you just write something like this:
This view is transparent and uses black paint to draw with your finger. So if you want see what you draw simply draw a white or gray bitmap on background of this view (you just add one line in the beginnig of onDraw), or you can use the background of the parent.
Then when you want to create an image from what you have drawn you just call
It depends on what you want to have as output, you can use this code or instead of parent you can do this with myDrawView and you get just the image you have drawn without background (since we have our myDrawView background transparent).
Hope this will help. Feel free to leave feedback.