In Android Studio I have a double variable called "zahl" that increases every second. I want a certain picture to be shown (and a text set) when zahl is in specific areas. Between these areas I want no picture to be shown. I tried it with only one area and everything worked out good:
if (zahl >= 1 && zahl <= 1.5) {
imageViewEarning.setImageResource(R.drawable.ice);
textViewEarning.setText(getString(R.string.textViewEarning_Eis));
}
else if (zahl >= 1.5) {
imageViewEarning.setImageResource(0);
textViewEarning.setText("");
}
Now I have it with multiple areas but the app always crashed when it reaches the first area where a picture should be shown:
if (zahl >= 1 && zahl <= 1.5) {
imageViewEarning.setImageResource(R.drawable.ice);
textViewEarning.setText(getString(R.string.textViewEarning_Eis));
}
else if (zahl >= 3.5 && zahl <= 4) {
imageViewEarning.setImageResource(R.drawable.hotel);
textViewEarning.setText(getString(R.string.textViewEarning_Kebab));
}
//and so on
else {
imageViewEarning.setImageResource(0);
textViewEarning.setText("");
}
I see no reason for this, has anyone an idea
Aucun commentaire:
Enregistrer un commentaire