sorry to ask question already asked. but i am helpless
in my programi have 27 imageview's which can display any of the 3 drawable's i have in my drawable's folder.. and i want these imageview's click to perform a different action for each drawable they contain..but i found that we won't be able to compare two drawable's for equality....
here’s the code i wrote, which didn’t work….
if(((ImageView)arg0).getDrawable() != getResources().getDrawable(R.drawable.sq))
i have googled it but no one was clear….they were saying we could use setTag() method but i am not able to figure out How . so please have pity on me and tell me how could i use setTag() in solving my problem with a example
Using setTag() is pretty straightforward. Either you use void setTag (Object tag) and you just provide an object to identify your drawable (typically a String) or if you need to store several properties you can use the void setTag (int key, Object tag) to provide an integer key.
Code example (this code has not been tested but it should explain what I mean by itself):