jeudi 5 mars 2015

Having trouble with findViewById in Android



I have a for loop which is running through an an array of imageView ID's that correspond to imageViews in my 'Board' class. The code is below:



for (String s : chunks) {
String possibleSquare = "s" + s.substring(2, 4);
ImageView backgroundImg = (ImageView) findViewById(R.id.possibleSquare);
backgroundImg.setBackgroundColor(Color.rgb(255, 255, 255));


I'm getting an error with findViewById and possibleSquare, specifically that Android 'cannot resolve' either.


What am I doing wrong?




Aucun commentaire:

Enregistrer un commentaire