0

I have a button. when I click that button my app should look like 2nd one.
before clicking button: enter image description here


after clicking button background color of some item will be changed. like this:

enter image description here

Abu Saeed
  • 1,020
  • 8
  • 21
  • 1
    for this you have to set flag in its data array isSelected = false, when you select an item set this boolean to true, and in bind viewHolder check is isSelected is true then change color else normal color for unselected – Abdur Rehman Sep 23 '20 at 06:16
  • I have an arrayList called isSelected and I have true value for those which are selected. But how will I change when button clicked? Can you give me the code or tell step by step.(I am a beginner).
    extra: I can select one and dis select it by clicking on it. But I how do I change color more than one item using button.
    – Abu Saeed Sep 23 '20 at 06:24
  • by using interface set in adapter and use it in respective activity – Abdur Rehman Sep 23 '20 at 06:27
  • can you give me code? – Abu Saeed Sep 23 '20 at 06:27
  • 1
    https://stackoverflow.com/questions/27194044/how-to-properly-highlight-selected-item-on-recyclerview – Abdur Rehman Sep 23 '20 at 09:55
  • Go through with this stack once. https://stackoverflow.com/questions/50875775/change-recyclerview-item-background-onclick – Apps Maven Sep 29 '20 at 04:14
  • already solved, forgot to comment – Abu Saeed Sep 29 '20 at 05:19

0 Answers0