When I enter a value in the EditText, i can't to compare it with a Value in My SharedPreference .
This is my EditText Preference
<EditTextPreference
android:defaultValue="1234"
android:inputType="number"
android:key="userid"
android:maxLength="4"
android:singleLine="true"
android:summary="To Access App setting set a PIN"
android:title="Set PIN" />
And This is My Methode code:
private void GoToSettings(){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplication());
String userpin = prefs.getString("userid", "");
String userpin1 = txtpin.getText().toString();
if(userpin.equals(userpin1)){
/*Intent intent = new Intent(FingerprintScannerActivity.this, PreferencesActivity.class);
startActivity(intent);*/
Toast.makeText(getApplicationContext(),
"Good",
Toast.LENGTH_SHORT).show();
}else Toast.makeText(getApplicationContext(),
"Error PIN",
Toast.LENGTH_SHORT).show();
}