I have a custom gridview.
In that, am using a frame layout which contains a image button, textview and a view. I need to change the background color of imageview/ text color of textview and drawable of view when an item is pressed.
In order to achieve that, I performed setOnClickListener
inside that adapter. And to undo the changes i implemented setOnLongClickListener
.
Now the question is, I want to change background color and all for only one item at a time. How do I achieve that? If item1 was selected previouslt,it should be unselected when I click on item2.
Let's say I store the position of item which has been clicked, how do I perform setOnLongClickListener
for the item on that position when another item is clicked?
Item1 Item2 Item3 Item4
Y N N N
Position :0
Now after clicking on Item2,
Item1 Item2 Item3 Item4
N Y N N
I need to perform onlongClicklistener for that position.