I am currently programming my first Android app and want to use a for-loop to add items to a View. This is done by Java:
for (int i = 1; i < 27; i++){
items.add(new Item("Wallpaper " + i, R.drawable.wallpaper1));
}
Am I able to use the variable "i" inside the "R.drawable.wallpaper_" call? The result should be something like:
items.add(new Item("Wallpaper " + i, R.drawable.wallpaper1));
items.add(new Item("Wallpaper " + i, R.drawable.wallpaper2));
items.add(new Item("Wallpaper " + i, R.drawable.wallpaper3));
and so on.
Thanks in advance Tafelbomber