我正在製作一個應用程序,使其能夠禁用鍵盤保護程序,但它僅在第一次調用此活動時起作用,之後它仍處於我第一次設置的狀態。keyguard管理員沒有迴應
static boolean k=true;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
if(k)
{
Log.d("unlock", "done");
KeyguardManager myKeyGuard1 = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);
KeyguardLock myLock1 = myKeyGuard1.newKeyguardLock(null);
myLock1.disableKeyguard();
k=false;
finish();
}
else{
Log.d("lock", "done");
KeyguardManager myKeyGuard = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);
KeyguardLock myLock = myKeyGuard.newKeyguardLock(null);
myLock.reenableKeyguard();
k=true;
finish();
}
setContentView(R.layout.home);
}
有你活動的onResume移動相同的後重?? – 2012-07-07 14:42:40
嘗試過....still不工作 – jaisonDavis 2012-07-07 15:21:21