My if-statement does not go through the other ifs and just goes to the last elseif-statement without even checking the condition. I also have other if-statements similar to the one below but they are working just fine.
Cursor getSumWords76 = mDatabaseHelper.getSumWords(selectedID, "red");
double red = -1;
while(getSumWords76.moveToNext()) {
red = getSumWords76.getInt(0);
}
red = (red/50)*100;
red_points.setText(String.format("%.0f", red) + "%");
if (red >= 20 && red < 40){
red_bar.setImageResource(R.drawable.bar20);
}
else if(red >= 40 && red < 60){
red_bar.setImageResource(R.drawable.bar40);
}
else if(red >= 60 && red < 80){
red_bar.setImageResource(R.drawable.bar60);
}
else if(red >= 80 && red < 100){
red_bar.setImageResource(R.drawable.bar80);
}
else if(red >= 100){
red_bar.setImageResource(R.drawable.bar100);
}
Aucun commentaire:
Enregistrer un commentaire