When I parse an empty string from a textview, it says unknown int "" when I already set a conditional if that takes that case. Code as below.
else if (naqaBoolean) {
int i;
int durasiHaidh = 24;
int tempohSebenar = 0;
for (i = 1; i < 17; i++){
TextView tvStatus = findViewById(getResources().getIdentifier("status" + i, "id", MainActivity.this.getPackageName()));
TextView tvTempoh = findViewById(getResources().getIdentifier("tempoh" + i, "id", MainActivity.this.getPackageName()));
TextView tvMenstruasi = findViewById(getResources().getIdentifier("menstruasi" + i, "id", MainActivity.this.getPackageName()));
int hariIni = 0;
String text = (String.valueOf(tvTempoh.getText()));
if(text == "Seharian"){
hariIni = 24;
} else if (text == "-"){
hariIni = 0;
} else if (text == ""){
hariIni = 0;
} else {
hariIni = Integer.parseInt((String) tvTempoh.getText());
}
tempohSebenar = tempohSebenar + hariIni;
}
Toast.makeText(getApplicationContext(), tempohSebenar, Toast.LENGTH_SHORT).show();
}