看看这个项目android-lockpattern它应该可以解决问题。
例如,要创建新模式,请使用
...
// this is your preferred flag
private static final int _ReqCreatePattern = 0;
...
Intent intent = new Intent(context, LockPatternActivity.class);
intent.putExtra(LockPatternActivity._Mode, LockPatternActivity.LPMode.CreatePattern);
startActivityForResult(intent, _ReqCreatePattern);
然后得到结果
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case _ReqCreatePattern:
if (resultCode == RESULT_OK) {
String pattern = data.getStringExtra(LockPatternActivity._Pattern);
...
}
break;
}
}