I have the following problem My list has 24 items when is showing them on the NestedScrollView - ReycleView its show 21 items and duplicate 3 of them so 24 item and 2 or 3 item are not shown instead have duplicates. This is my code I try everything from this question stackoverflow question so I don't need to share my Adapter.
XML:
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_noti"
tools:listitem="@layout/rv_noti"
android:layout_width="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/txt1"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"/>
Fragment:
public class AllFragment extends Fragment {
View view;
TextView day, notificationTitle, notificationBody;
RecyclerView rv;
ArrayList<Object> notifications;
private DBHandler dbHandler;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_all, container, false);
rv = view.findViewById(R.id.rv_noti);
dbHandler = new DBHandler(AllFragment.this.getContext());
try {
notifications = dbHandler.readCourses("Notifications");
} catch (ParseException e) {
e.printStackTrace();
}
NotiAdapter adapter = new NotiAdapter(notifications, getContext());
rv.setAdapter(adapter);
rv.setLayoutManager(new LinearLayoutManager(getActivity()));
return view;
}
}