I need to check on a button click if there is a drawing associated with the list or if its “invisible”. I am doing the check by seeing if the source of the drawing is @drawable/invisible or something else. If its something else then change it to invisible, if invisible then change it to a color etc…
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View listview, int position,
long arg3) {
ImageView pincolor=(ImageView) listview.findViewById(R.id.ivimtrackingpin);
// here is where I want to check what the "source" is
if(pincolor.getResources().equals(R.drawable.invisible)
//do stuff
else
pincolor.setImageresource(R.drawable.invisible)
}
});
I don’t want to just do setvisibility =invisible because there are different colors that each list can be and the switch function will go inside the if part. What method do I use to determine the imageviews source?
Thanks
Maybe you can make use of the ImageView’s getDrawable() Method.
like this: