10

I am currently developing an app for android 2.2 or above.

I want to allow the user to enable a login before having access to the app. I want to allow the user to choose between various types of login like password, pin or pattern.

I was wondering if would be possible to add a pattern lock to my own app. Is there a plugin I can use to create one or use android's pattern lock for my own app. I only want this for the app I don't want it to change how the actual device is locked.

Thanks for any help you can provide.

Boardy
  • 35,417
  • 104
  • 256
  • 447
  • Why wouldn't you look into Android source code, to get [one](https://code.google.com/p/android-lockpattern/)? –  Mar 11 '12 at 02:13
  • [check this library](http://androidcustomviews.com/portfolio/android-lock-pattern/) – Girish Bhutiya Aug 08 '13 at 09:28

3 Answers3

9

I dont think there is a widget for this. I would create a matrix of images 3x3 give them each a listener and keep track of the order the user presses them. Then take the order, 2,3,6,5,8 for example, save them as a string "23658" this is the password! hash and save that somewhere. whenever a user inputs the button order compare the input hash to the saved one.

Wayner
  • 3,303
  • 1
  • 16
  • 10
  • Thanks for the help, this sounds like a good idea. Will give it a try – Boardy Mar 06 '11 at 22:33
  • I tried with your idea.I created a matrix of images 3x3 gave them each a onTouch listener. The main problem is an user has to touch all button separately to create a pattern, dragging a pattern is not supported.. Any further idea? – Syamantak Basu May 28 '14 at 11:17
2

If any body is still searching for the answer, I found this library which is pretty useful and much better than the android-lockpattern, hosted on GitHub

Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
RmK
  • 1,408
  • 15
  • 28