• 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 ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Changing View Visibility in RecyclerView

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Rv with imageViews and checkboxes, i'm trying to hide the imageviews and unhide the checkboxes on long click for all the list item and,only the visible item's view only changes but not the other item's views and also the view changes back to original when scrolling.so far i can do this with the following code.



Is there any good way to do what i want..
 
Saloon Keeper
Posts: 7175
166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm confused. You said both "i can do this" and "Is there any good way to do what i want." - those two statements would seem to contradict each other. If the code you posted does not do what you intend, what does it do instead? And where, specifically, are you stuck making the require changes?
 
dev goku
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok,i have text,imageview and chechboxes on the RV, I want to change the images to ckeckbox for every item on Long click ,I use HashMaps here,but  on long Click the visible items in the viewholder changes and while scrolling i can see few items has also changed but not all the items after that and the changed items also seems to change its visbility back to original.
 
Tim Moores
Saloon Keeper
Posts: 7175
166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem is that the MyViewHolder constructor sets the state for all items (in lines 33 and 34), when it should set those values only for the newly constructed item. You would call getAdapterPosition()  to find out which one that is.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic