I have updated this post.Please see the updated post
If you have thousands of records in your database server, rather than getting all records loading at a time, try to load some x number of records in the onscroll event and update the ui,
If you have 1000 records in the server db, get 50 records first time, if the user reached to the last record in the ui, then again load 50 more records in the onscrolllistener event.
In this example, i am using following github code snippet for endless RecyclerView
Credit goes to: WoongBi Kim
Now, Create an Activity with RecyclerView in the XML Layout file.
Now create an adapter for the RecyclerView