I try to update my imageiew using buttons
private void visitUpdateImage(int type) {
if(type == 0){
if(ecran != 1){
ecran--;
}
}
else if(type == 1){
if(ecran != nbEcrans){
ecran++;
}
}
int[] images = new int[nbEcrans];
images[0] = R.drawable.ecran1;
images[1] = R.drawable.ecran2;
images[2] = R.drawable.ecran3;
images[3] = R.drawable.ecran4;
images[4] = R.drawable.ecran5;
images[5] = R.drawable.ecran6;
images[6] = R.drawable.ecran7;
ImageView image = (ImageView) findViewById(R.id.imageView);
image.setImageResource(images[ecran - 1]);
System.out.println(ecran);
}
The begining is good but images[5] il loading ic_launcher instead of ecran6 and the image[6] load nothing
I have all my ecrans in all my drawable repositories
Thanks for help
Just guessing (Your conditions are wrong) Use: