public void inValidMobileNumber() {
if (TokenUtils.isInvalidDob() ) {
startActivity(new Intent(PersonalInfo.this,PassTwo.class));
overridePendingTransition(R.anim.dashboard_right_from,R.anim.dashboard_right_to);
TokenUtils.setisInvalidDob(false);
}
else {
TokenUtils.setisInvalidDob(true);
Intent intent = new Intent(PersonalInfo.this, MobileNumber.class);
intent.putExtra("reportId", reportId);
intent.putExtra("activityCode", CreditMantriConstants.TELL_US_MORE_ACTIVITY);
startActivity(intent);
overridePendingTransition(R.anim.dashboard_right_from, R.anim.dashboard_right_to);
}
}
public static void setisInvalidDob(Boolean dob){ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CreditMantriApplication.getCreditMantri()); final SharedPreferences.Editor edit = preferences.edit(); edit.putBoolean(" DOB",DOB); edit.apply(); }
public static Boolean isInvalidDob()
{
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(CreditMantriApplication.getCreditMantri());
return preferences.getBoolean("dob",false);
}
这是我的第二次获得invalidDob
的代码答案 0 :(得分:1)
使用
edit.commit();
而不是
edit.apply();
as edit.commit(); edit.apply();在后台做