First time data loaded correct in recyclerview using databinding ,Need to update the recylerview when user type anything in editText , onTextchange getting new list that need to show in recylerview but its showing old list only.
How to implement this using Databing.
Code -: In Adapter
@Override
public void onBindViewHolder(FoodsAdapter.ViewHolder holder,final int position) {
binding=holder.getBinding();
binding.setAdapter(this);
binding.setActivity(mActivity);
binding.setVariable(BR.food,foodList.get(position));
/* binding.setFood(foodList.get(position));*/
binding.setPosition(position);
binding.executePendingBindings();
}
Set Adapter in RecylerView
binding.rvFood.setAdapter(null);
binding.rvFood.setAdapter(new FoodsAdapter(activity,foodList));
Getting old list with new one when i enter anything in edit text but when coming from background to foreground correct data shows .