I'm confused with an exception that is thrown for something that shouldn't. The error is the following:
java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
But, my code doesn't try to cast a Boolean to String Ô_o Is it possible that the compiler is wrong in indicating where the exception is coming from? I'm using an Huawei
This part triggers the exception:
if(SharedPreferencesManager.getUserMRZ(ScanEUID.this).equals("0")
&& SharedPreferencesManager.getUserDocumentIdFront(ScanEUID.this) != null
&& SharedPreferencesManager.getUserDocumentIdBack(ScanEUID.this) != null)
{
The associated methods are the following
public static String getUserMRZ(Context context){
return getSharedPreferences(context).getString(Constants.USER_HAS_MRZ, "0");
}
public static String getUserDocumentIdFront(Context context) {
return getSharedPreferences(context).getString(Constants.USER_DOCUMENT_ID_FRONT, null);
}
public static String getUserDocumentIdBack(Context context) {
return getSharedPreferences(context).getString(Constants.USER_DOCUMENT_ID_BACK, null);
}
The setMRZ method
public static void setUserMRZ(Context context, String has_mrz){
final SharedPreferences.Editor editor = getSharedPreferences(context).edit();
editor.putString(Constants.USER_HAS_MRZ, has_mrz);
editor.apply();
}