I am retrieving object arraylist of a recyclerview item ,my function on the fragment is updated ,but my arraylist on oncreateview remains null, how can i observe the updated value on realtime ?
public void gettolist( ArrayList<Profilefire> profilesingle) {
profilestoinvoice=profilesingle;
Log.v("listtocheck",profilestoinvoice.size()+" ");
}
-----> this shows size is updating
facture.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.v("listtocheck",profilestoinvoice.size()+" ");
}
});
------> but here on the main onCreate method where i am handling my button click,the array keeps showing null
@Override
public void onBindViewHolder(@NonNull UserHolderFacture userHolderFacture, int i) {
final Profilefire profilefire =profiles.get(i);
userHolderFacture.updateUI(profilefire);
if (!isSelectedAll) userHolderFacture.checkall(false);
else userHolderFacture.checkall(true);
userHolderFacture.getFacturecheck().setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
profilestoinvoice.add(profilefire);
invoicingFragment.gettolist(profilestoinvoice);
}else {
profilestoinvoice.remove(profilefire);
invoicingFragment.gettolist(profilestoinvoice);
}
}
});
}