In this post i am going to explain how to draw on android screen this is very basic example but we can use this in many of our application like e commerce. I name this app as signature app because we can take user signature on screen and save them. You can download application code from below link.


Save User Signature in Android Application

Step 1. Create new android project in Android Studio.

Step 2. Open layout file (activity_main.xml) and define white background

Step 3. Now open and place below code in it in this code we going to use DrawingView, Paint and Canvas classes of android.

In above code i create DrawingView class inside my MainActivity. With help of this class i am able to draw on android screen and also get the location where user point  his finger. You can set color if you want this class is very easy and simple to read.

Step 4. After successfully creating signature we need to save user sign as image so remember to provide read/write permission in your AndroidManifest.xml file. And to save canvas image i use this method.

with help of this method you save your signature and now create new activity where we can preview our signature.

Step 5. Create new activity file where we can image. Copy below code and paste in your file.

You need to add ImageView on your layout file to preview image.

That’s it, for complete code you can follow above download link. 🙂