I'm trying to check if some floats (previously were EditTexts converted to Floats) are null, it is simple but my Application just breaks with this code below.
Does Android has any problem if floats are used combined with logic comparators?
if ((janeiro != null)&&(fevereiro!=null)&& (março!=null) &&
(abril!=null) && (maio!=null) && (junho!=null) && (julho!=null) &&
(agosto!=null) && (setembro!=null) && (outubro!=null) &&
(novembro!=null) && (dezembro!=null)) {
Float media = janeiro + fevereiro + março + abril + maio + junho + julho + agosto + setembro + outubro + novembro + dezembro;
media=media/12;
m[0] =media;
Toast.makeText(getApplicationContext(), "O consumo médio do cliente é " + media, Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(), "Tem de algum mes faltando", Toast.LENGTH_LONG).show();
}
0 comments:
Post a Comment