Tutorial on How to code Pattern Lock in Android

Now a days security is most important aspect. Our phone has many important data which might be very important to the owner of the phone. In this case he/she has to protect his/her data by adding some kind of security by pass so that it is not accessible to the intruder.

In this case we can use pattern lock to protect our data from intruder. So to add this pattern lock to your android application just follow below steps.  Let’s get started.

Just add a gradle compile link in your gradle.app.

Now sync your gradle so that this library can be included in your android project.

Building our android application

  • Creating User Interface

In res  => colors.xml add the below code.

Now to make our app more attractive add bg_rad.xml in drawable.

Now finally designing our main layout.

pattern lock

  • Building Application

Now in mainActivity define the patternViewLock variable along with its override methods.

Even you can add the following method to save lock pattern.

Now finally adding the whole code in mainActivity.java.

That’s it guys now your app lock is ready. Now you can include it in any android application as per your need. If you have any problem then please free to comment down below.

6 thoughts on “Tutorial on How to code Pattern Lock in Android”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.