使用KeyguardManager时,如何删除取消按钮?左侧显示一个取消按钮。

if(km.isKeyguardSecure()) {
            Intent i = km.createConfirmDeviceCredentialIntent("Authentication required", "password");
            startActivityForResult(i, CODE_AUTHENTICATION_VERIFICATION);
        }

  @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(resultCode==RESULT_OK && requestCode==CODE_AUTHENTICATION_VERIFICATION)
        {
            Toast.makeText(this, "Success: Verified user's identity", Toast.LENGTH_SHORT).show();
            Session.setLock(false);
            startActivity(new Intent(this,WelcomeACtivity.class));
        }
}

最佳答案

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(resultCode==RESULT_OK && requestCode==CODE_AUTHENTICATION_VERIFICATION)
        {
            Toast.makeText(this, "Success: Verified user's identity", Toast.LENGTH_SHORT).show();
            Session.setLock(false);

            startActivity(new Intent(context,WelcomeACtivity.class));

        }
        else if(resultCode == RESULT_CANCELED && requestCode == CODE_AUTHENTICATION_VERIFICATION)
        {
            finish();
        }
        else
        {
            Toast.makeText(this, "Failure: Unable to verify user's identity", Toast.LENGTH_SHORT).show();

        }
    }

10-08 12:30