new Keyguard Lock - Android User Interface

Android examples for User Interface:Input Method

Description

new Keyguard Lock

Demo Code


//package com.java2s;

import android.app.KeyguardManager;
import android.app.KeyguardManager.KeyguardLock;

import android.content.Context;

public class Main {

    @SuppressWarnings("deprecation")
    public static KeyguardLock newKeyguardLock(Context context, String tag,
            KeyguardLock lastLock) {//ww  w . j  a v  a2  s . c o  m
        if (lastLock != null) {
            lastLock.reenableKeyguard();
        }
        KeyguardManager km = (KeyguardManager) context
                .getSystemService(Context.KEYGUARD_SERVICE);
        KeyguardLock lock = km.newKeyguardLock(tag);
        lock.disableKeyguard();
        return lock;
    }
}

Related Tutorials