Could not re-enable the KeyGaurd once disabled it
问题 I have write below code to toggle the KeyGaurd of my android phone using a toggle button. but I am facing an strange behavior. it disables the keygaurd successfully but. not re-enabling. btnToggleLock.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (btnToggleLock.isChecked()) { toast.cancel(); toast.setText("Unlocked"); toast.show(); Log.i("Unlocked", "If"); KeyguardManager myKeyGuard = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);