-2

My app have an button(B1) custom ListView that item view include : checkbox,textview

Goal is I press button B1 then all checkbox in ListView will be setVisible and I had done it BUT THIS IS WORK FOR WHAT IS SHOWING ON SCREEN. When I scroll Listview in case multi-rows that the others not be visibled

Let's see my explanation: - Example that there is 10 items in list data -> Listview on current screen just show 5 items ( 10 items is still visible when scroll) - When press button B1 that just CHECKBOX of 5 items is visible, the others is not working

I mean I want to change layout of view item right on Activity

IRIS
  • 11
  • 3

1 Answers1

0

Because you are only updating the views of layout. You need to also update your data set (array of your adapter of listview) but I know you don't have a boolean variable in your data set to decide whether checkboxs are visible or not. First you need to add variables. After button clicked, don't update views of layout. Only change the datas (boolean variables) and call notifyDataSetChanged() method of your custom adapter. notifyDataSetChanged() method will recall your getView() method of your adapter for all views visible in your screen. Values will be updated correctly if you check visibility of views in your getView() method. Other items after scrolling will be correct because your getView() method is correct.

If you don't understand the answer add your OnClickListener of button and your custom adapter class. I will update them.

Edit: You have focused on the wrong problem. Your solution isn't related to updating the layout. You have problem about logic of how listView should works.

Efe AYDIN
  • 193
  • 12