因此,我有一项活动会越过我的锁屏。但是当我退出它时,它会破坏我的锁屏。好的,不是字面意思......但我无法再次成功锁定我的手机。我必须重新启动它。我觉得我只是忘记在我的 onDestroy 中放一些东西 - 就像我必须在完成锁屏后重新评价它。同上。问题是什么?
锁屏活动:
@Override
public void onCreate(Bundle icicle){
super.onCreate(icicle);
setContentView(R.layout.lockscreen);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);//gotta get it to open on lock screen
ImageView iv = (ImageView)findViewById(R.id.Background);
//iv.getBackground().setAlpha(50);
Button close = (Button)findViewById(R.id.Close);
close.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
finish();
}
});
KeyguardManager km = (KeyguardManager)getSystemService(KEYGUARD_SERVICE);
final KeyguardManager.KeyguardLock kl = km.newKeyguardLock("IN");
kl.disableKeyguard();
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
PowerManager.WakeLock wl=pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.FULL_WAKE_LOCK, "My_App");
wl.acquire();
/*Builder adb = new AlertDialog.Builder(this);
adb.setMessage("Testing");
adb.setCancelable(false);
adb.setNeutralButton("Close",new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
kl.reenableKeyguard();
}
});
AlertDialog ad = adb.create();
ad.show();*/
wl.release();
}
如您所见,我刚刚完成了活动。我是否忘记在销毁上做某事?
谢谢