I have 4 button seen below sequentially numbered in my layout file. In my code i want to get in a loop the advert that corresponds to the position we are in the loop e.g for the second time around in the loop i would get advert2 back.
Can anyone help. Thanks
Button advert1 = (Button) findViewById(R.id.advert1);
Button advert2 = (Button) findViewById(R.id.advert2);
Button advert3 = (Button) findViewById(R.id.advert3);
Button advert4 = (Button) findViewById(R.id.advert4);