I have a problem, maybe you can help me, in the onclick event of a recycler I want to send a boolean to its fragment to update a method, but I do not know how to do it.
before I had done it but not with an adapter from a fragment, this is the adapter code that worked for me before. Adapter
holder.btMinus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
((ActividadPrincipal) view.getContext()).updateItemCount(true);
}
and I received it in the main activity in this way:
public void updateItemCount(boolean ifIncrement) {
if (Common.cartRepository.countCartItems()==0) {
// Linearlayoutvacio.setVisibility(View.VISIBLE);
//Linearlayoutlleno.setVisibility(View.INVISIBLE);
}
try to do it in the same way by sending a bollean to its fragment changing only "Main Activity" for "My fragment" but it does not work.
((Selection2) view.getContext()).updateItemCount(true); ----AQUI OCACIONO EL ERROR NO ME DEJA COLOCAR "Seleccion 2"EL CUAL ES MI FRAGMENT
I appreciate your help.