I am trying to set Imageview using a function
that if we send Image drawable to a function that function set that drawable to the respective Imageview.
This is function code in which it gets "id" and after that respective id function will call
public void showpeg(int id) {
switch (id) {
case 1:
showSeagreen(R.drawable.seagreen);
break;
}
}
This is my ShowSeagreen() function
public void showSeagreen(Drawable draw) {
if (iRow == 1) {
if (iPlace == 1) {
seagreen = 1;
one_first.setBackgroundResource(R.drawable.draw);
iPlace++;
} else if (iPlace == 2) {
seagreen = 2;
one_two.setBackgroundResource(R.drawable.draw);
iPlace++;
}
}
I know i am doing it wrong but i can't find a way to do this Please any help
Thanks in advance
instead of
showSeagreen(R.drawable.seagreen);
use: