Hello All;
I want to to enter myImage image to every different value that variable 'kare' takes.
Th values of the ImageViews are like a8,b8, c8... etc (the coordinates of a chess board).
The question is how to get these id's from a variable like the code below. Unfortunately with the code below
the line that reads "ImageView ll = (ImageView) findViewById(R.drawable.kare);" gives an error with 'kare' highlighted as Red.
Thank you in advance....

pozisyonKlasi hamleGonder = new pozisyonKlasi();
        String[][][] gelPozisyon = pozisyonKlasi.pozisyon;
        for (int i = 0; i < 12; i++) {
            for (int j = 0; j < gelPozisyon[denm3][0].length; j++) {
                String kare = gelPozisyon[denm3][0][j];  //my variable
                ImageView ll = (ImageView) findViewById(R.drawable.kare);
2 Years
Discussion Span
Last Post by AleMonteiro

Your error is not when setting the image, is getting the ImageView object.

R.drawable.kare is not the ImageView Id, it's a drawable.

If you get the ImageView correcly then you can use setBackgroundDrawable or setImageBitmap instead of setBackgroundResource.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.