I'm new to Android Development and trying for the first time to implement a databinding between a RecyclerView and a SQLite Database. Now I've been searching for examples and tutorials on the topic and found less information than I expected.
The few solutions I found, like this one: Display SQLite data in RecyclerView, always seem to query the database for all data, store it recursively into a List which then is passed on to the RecyclerView.Adapter. The adapter class is then browsing through the Items by referring to the items in the List<Item>
.
Now for the actual question: Is this solution smart? I'm a hobby programmer, hence I'm far from being an expert for database and / or memory design. This solution though leaves me with a headache, since querying the database for all items and storing them in an array seems not only to defeat the advantage of querying a SQLite Database, but also appears to have the risk of polluting the memory (and thereby dropping performance). Hence: Is there a better solution for binding database data to a RecyclerView or is the Array<Item>
-Query-All-Solution just fine for the purpose?