0

I am using The Movie Database Api to load Tv Shows in my recyclerview. I am able to load the views in my recycler view. The url i am using is https://api.themoviedb.org/3/tv/airing_today?api_key=MY_API_KEY&page=1

It loads all the views from page 1 in my recyclerview. What i want is as soon as user reaches end of recyclerview it should load the next page and so on i.e at the end of recycler view i want to load https://api.themoviedb.org/3/tv/airing_today?api_key=MY_API_KEY&page=2

I know i can do it by adding next and previous button below my recyclerview,but i don't want to do that approach. How to automatically load next page as soon as user reaches end of recycler view. FYI,I am using Retrofit. Please help.

hagrya
  • 95
  • 1
  • 13
  • You can detect when you need download next(previous) data and then you start request to retrieve these data. But what you do when something went wrong(e.g. internet disconnected) and a user should do something before you can try to repeat your request? I think one good way - you try to load automatically(without user) then if unsuccessfully - show "prev page"/"next page" button to the user. – Dima Kozhevin Oct 13 '17 at 05:08
  • But i dont want to show "prev page"/"next page" button. How can i know that i have reached end of recyclerview. – hagrya Oct 13 '17 at 05:26
  • see https://stackoverflow.com/q/36127734/3166697 or https://stackoverflow.com/q/40726438/3166697 or https://stackoverflow.com/q/26543131/3166697 – Dima Kozhevin Oct 13 '17 at 05:36
  • To be honest I start thinking that your question is a duplicate of https://stackoverflow.com/q/26543131/3166697 – Dima Kozhevin Oct 13 '17 at 05:41
  • Possible duplicate of [How to implement endless list with RecyclerView?](https://stackoverflow.com/questions/26543131/how-to-implement-endless-list-with-recyclerview) – Dima Kozhevin Oct 13 '17 at 05:42

0 Answers0