Android implements gesture password function

This example shares the specific code for Android to realize gesture password function for your reference. The specific contents are as follows

First of all, the layout of Jiugong grid is written by a great God from the Internet. If you implement it in the project, you can directly copy the drawl, guesturelockview and point classes into your own project; If you want to understand the functions, you can take a closer look at the three classes in the source code, which are also written in great detail;

Three steps to using guesturelockview:

1. Initialize the layout container; 2. Initialize guesturelockview; 3. Add guesturelockview to the layout container:

Create guesturelockview:

There are two callbacks. Checkedsuccess () represents a successful callback, that is, the graphical interface you initialize in the page, which is actually a string of type string; Checkedfail() failed callback, which is hardly used here;

Set parent layout for guesturelockview:

In this demo, the set password is saved in sp. the main page also determines whether the password has been set according to the existence of sp. if no password is set, click reset password prompt: no password is set; The password needs to be set twice to prevent user misoperation; When you click set password, you will judge whether you set the password for the first time or the second time according to a global variable. If the two passwords are the same, they are saved successfully and directly saved in sp. if they are different, setting the password fails and needs to be reset;

The layout has only two buttons, which will not be copied here. Let's take a look at the logic of creating guesturelockview in the activity setting password:

Source download

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>