I have an imageButton :
img = (ImageButton)findViewById(R.id.image3);
I wanted to check if this img has a specific image , if yes then it changes to another image.
How can I get and store the image resource and later can be used to compare with the current image source?
this is da code :
ImageButton img = (ImageButton)findViewById(R.id.image3);
int resource = img.getResources().getInteger(android.R.drawable.btn_star_big_off);
if(resource==android.R.drawable.btn_star_big_off)
{
img.setImageResource(android.R.drawable.btn_star_big_on);
}
Doesn't seem to be working Any other way?