I have list of items inside of recyclerview, and they are multiple selectable.
I want to have select button to select all, and if selected deselect all. I didn\'t se
In my case,
Step - 1 :- first globally initialize flag in activity class
boolean flagSelectAll = false;
Step - 2 :- Then set below code in Onclick of Button
@OnClick(R.id.btnSelectAll)
public void setBtnSelectAll(View view){
for (int i=0;i
Step - 3 :- Then create method selectAllItem in recyclerview's adpater class like below :
public void selectAllItem(boolean isSelectedAll) {
try {
if (itemList != null) {
for (int index = 0; index < itemList.size(); index++) {
itemList.get(index).setSelected(isSelectedAll);
}
}
notifyDataSetChanged();
} catch (Exception e) {
e.printStackTrace();
}
}