Items Not Showing Up In Recycleview From Room Database
After previous debugging I've asserted that my database is indeed working correctly however even though it appears although I've set up the ReycleViewAdapter correctly the data is
Solution 1:
There are two mistake in your adapter class correct
1). You should return the size
of your data results
ArrayList
in getItemCount()
Use this
@Override
publicintgetItemCount() {
return results.size();
}
Instead of this
@Override
publicintgetItemCount() {
return0;
}
2) Change your custom_row.xml
hight to wrap_content
like below code
Use this
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/customRow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
Instead of this
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/customRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
Post a Comment for "Items Not Showing Up In Recycleview From Room Database"