• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Get id of element in RecyclerView and add it in JSON Array as a JSON Object on onClick(), remove the

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am implementing a contacts app, I made a RecyclerView and am showing all the contacts that I fetched from the API. Now, when I select an item, its id (as JSON object) should be added to a JOSN Array and if I unselect the item then that JSON Object should be removed from the Array. I am able to add the id to the Array but when I select multiple items then I am not able to append the next object to the JSON Array. Similarly, when I unselect an item then that object should be removed from the Array.

Here is my Adapter Calss:

I knew I would regret that burrito. But this tiny ad has never caused regrets:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic