The Toast keeps saying access denied, even if i fill in the right pin.
I need to lock users into an kiosk-mode app, and only with the right pin they will have access to the settings and the exit option.
public void onClick(View v) {
AlertDialog.Builder alert = new AlertDialog.Builder(FullscreenActivity.this);
alert.setTitle("PIN:");
//alert.setMessage("Message");
final EditText pinEntry = new EditText(FullscreenActivity.this);
alert.setView(pinEntry);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String pin = pinEntry.getText().toString().trim();
String secret = "0000";
if (pin == secret){
Toast.makeText(getApplicationContext(),"Access Approved", Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(getApplicationContext(),"Access Denied", Toast.LENGTH_SHORT).show();
}
Toast.makeText(getApplicationContext(),pin, Toast.LENGTH_SHORT).show();
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
alert.show();
}
});