I have a Enter Password Dialog which is an Activity in a Theme.Dialog theme so it actually looks like a AlertDialog as i have to use it in a broadcast receiver but the problem is i want to block the HOME button as i need it for a security applications, the blocking of the HOME button works when i use this
@Override
public void onAttachedToWindow()
{
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}
but it doesn't relaunch my PasswordDialog activity if the password is wrong after clicking a button, any suggestions?
Validation code:
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);
}