211 RecyclerView Database Example |

Published: 17 March 2016
on channel: slidenerd
38,896
181

Launch Your First Android app with our TOP course at 82% OFF (24 hrs ONLY) HERE https://goo.gl/7veBXc
This video shows how to display data from database inside RecyclerView. In our case, we need to display data from Realm database inside our RecyclerView with the help of the RecyclerView.Adapter. The onCreateViewHolder is called initially when a row needs to be displayed for a few times and then the onBindViewHolder is called for all subsequent iterations. Create an Application subclass and override the onCreate method to define a RealmConfiguration which we set as the default configuration. In the main activity, we simply get an instance of Realm using getDefaultInstance using which we can query all the drops stored in our database asynchronously. We use a RealmChangeListener to be notified when the drops have finished loading from the database and store the results inside a RealmResults object. Finally we call notifyDataSetChanged method to refresh the RecyclerView as we add more items to it.


On this page of the site you can watch the video online 211 RecyclerView Database Example | with a duration of hours minute second in good quality, which was uploaded by the user slidenerd 17 March 2016, share the link with friends and acquaintances, this video has already been watched 38,896 times on youtube and it was liked by 181 viewers. Enjoy your viewing!