Android, ImageView objects in ArrayList

thanks for reading. I'm making an app that can write musical scales based on input from spinners in the layout. I have 11 of Imageviews that take a LOT of information from a LOT of spinners, then those imageviews change on the click of a button in the layout. In short, I want to store the ImageViews in an ArrayList. This is my idea:

//Initilization of ArrayList as a member:
ArrayList<ImageView> pics;

//in onCreate():
pics = new ArrayList<ImageView>();
pics.add((ImageView) findViewById(;
pics.add((ImageView) findViewById(; //etc through picK

//in onClick():
for (int i; i++; i<11){
    if ("test".equals(noteArray[i]) pics[i].setImageResource(R.drawable.testPic);
    if ("testTwo".equals(noteArray[i]) pics[i].setImageResource(R.drawable.secondTestPic);


But I am unable to use setImageResource() on pics[x]. It works fine on a regular ImageView object, am I using the ArrayList wrong?


use pics.get(i)

ArrayList uses uses a function to get an object at a particular location.

Need Your Help

Pack big float value in Python

python python-2.7

There're strange thing in pack/unpack floating point data in array. It changes one of last digits of number:

Flask sqlalchemy many-to-many insert data

python flask sqlalchemy flask-sqlalchemy

I am trying to make a many to many relation here in Flask-SQLAlchemy, but it seems that I don't know how to fill the "many to many identifier database". Could you please help me understand what I am