Theme.Dialog 테마의 활동 인 비밀번호 입력 대화 상자가 있습니다. 따라서 브로드 캐스트 수신기에서 사용해야하므로 실제로 AlertDialog처럼 보이지만 문제는 HOME 버튼을 차단하고 싶습니다. 내가 보안 응용 프로그램을 필요에 따라, 어떤 제안을 내가이홈 버튼 사용 안함
@Override
public void onAttachedToWindow()
{
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}
를 사용하지만 암호가 버튼을 클릭 한 후 잘못되면 내 PasswordDialog 활동을 다시 시작하지 않는 경우, 홈 버튼의 차단 작동?
검증 코드 :
더 버튼을 입력하여 대화 상자에서 사용중인 검증에 문제처럼 보인다login.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
password = inputPassword.getText().toString();
final String SHA1hash = PhysicalTheftPassword.getSHA1(password);
if (correctSHA1.equals(SHA1hash)) {
//SharedPreferences sp = getSharedPreferences("isPhysicalTheftEnabled", MODE_WORLD_READABLE);
//SharedPreferences.Editor ed = sp.edit();
//ed.putBoolean("isPhysicalTheftEnabled", false);
//ed.commit();
Toast.makeText(PhysicalTheftDialog.this, "Correct", Toast.LENGTH_LONG).show();
finish();
stopService(new Intent(PhysicalTheftDialog.this, MyService.class));
Log.v(TAG, "SHA1 Hash:" + SHA1hash);
Log.v(TAG, "Correct SHA1:" + correctSHA1);
}
else {
Toast.makeText(PhysicalTheftDialog.this, "Wrong", Toast.LENGTH_LONG).show();
Intent Act2Intent = new Intent(PhysicalTheftDialog.this, PhysicalTheftDialog.class);
finish();
startActivity(Act2Intent);
Log.v(TAG, "SHA1 Hash:" + SHA1hash);
Log.v(TAG, "Correct SHA1:" + correctSHA1);
}
http://stackoverflow.com/questions/6836869/android-how-to-control-the-home-button?rq=1? – t0mm13b
나는 당신이 찾고있는 것을하는 사람의 예를 보았습니다. 희망이 도움이됩니다! http://stackoverflow.com/a/6530002/1559836 – Mintrus
글쎄, 그것은 "phantom"자바 소스 * DisableAllKey.java *를 언급하고있다. – t0mm13b