• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

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: 7627
177
  • 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: 7627
177
  • 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.
 
Get off me! Here, read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic