Seems like you are trying to create two arrays of int, holding different set of images. But you are using the same variable name pirates
. I would suggest you define two different variables int[] pirates
and int[] piratesNatural
and then switch between those two arrays when you need one and the other.
Bitmap icon;
if(natural)
icon = BitmapFactory.decodeResource(getResources(),piratesNatural[i]);
else
icon = BitmapFactory.decodeResource(getResources(),pirates[i]);