Run ListView section using checkbox?

I need a section Listviewwith a checkmark, and each row has some of them that I need in total for the selected row. Here I used Recyclerviewbecause of Lazy Loading. I need to use Listview. enter image description here

There are 10 members in the list of arrays in the list view, but initially I get only 4 row values, I need 10 initially. This is due to Lazy Loading.

Thanks in advance

+4
source share
1 answer

You can implement the user interface in your adapter. When you have checked your product from the list, you must transfer the result of your activity, and later you can make its amount.

interface CheckItemList{

        public void onCheckItem(int value){}

    }

onCheckItem()

CheckItemList checkItemList = (CheckItemList) mContext;

satView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

       @Override
       public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {
              if(isChecked){
       checkItemList.onCheckItem(value);
         }
       }
   }
); 

CheckItemList - - .

class MyActivity extends Activity implements CheckItemList.
  onCheckItem(int value){
  //Add your code to store checked value  
}

}

+3

Source: https://habr.com/ru/post/1665503/


All Articles