• Post Reply Bookmark Topic Watch Topic
  • New Topic

Remove images onClick using setTag() and getTag()  RSS feed

Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to dynamically add images when a button is clicked and an alert dialog pops up and an image can be selected. Once this happens, an image appears in one of two LinearLayouts I have created; five in each. Once the top fills up, they start going into the second.

I also want to be able to click the image and have it disappear and the images reorder themselves.

The issue I am having is when removing the images. It works if I add a single image and then remove it. If I add more than one image, I can only click one of them it it disappears. None of the other ones will work. If I then add more, I can click one of the newly added images and it will be removed and then I can't remove any again.

Below is the code for the listener to the dialog onclick and the class that is called for the removal and reorder of images. I think it may be an issue with how I am setting or resetting the tags but I am not totally sure.

Oh, the cart ArrayList contains objects pertaining to the image as well an the Integer drawable.

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!