I am writing a small app which queries a REST API to get JSON Data about movies. Which includes
- Movie ID
- Movie's Poster
- URL Movie Overview etc
My main view consists of a RecyclerView which uses a GridLayout Manager to display a grid of movie posters. On tapping, a grid view item would transition to an activity where details of the movie will be presented.
As mentioned above, the API Call would return all important details to build the experience, including the URL to download the Poster.
I will be using Okhttp and Picasso for networking and Image Download. This is my first app which interacts with the network so I need to know where should I put the Okhttp Async Networking Code to get the JSON Data and WHY?
- In the Fragment's OnCreate?
- In the hosting Activity's OnCreate?
- In the RecyclerView's Adapter?
I don't want the code, I just need to know what's the right place to fetch the JSON via Okhttp and why?