Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static Retrofit.Builder builder =
- new Retrofit.Builder()
- .baseUrl(API_BASE_URL)
- .addConverterFactory(GsonConverterFactory.create());
- page: 1,
- results: [
- {
- poster_path: "/sdfsdf.jpg",
- adult: false,
- overview: "Based upon Marvel Comicsโ most unconventional anti-hero, DEADPOOL tells the orig.",
- release_date: "2016-02-09",
- genre_ids: [
- 35,
- 12,
- 28,
- 878
- ]
- }],
- total_results: 254975,
- total_pages: 12749
- public interface MovieApi {
- @GET("3/discover/movie")
- Call<MovieDataRet> getMovieList(@Query("sort_by") String sort,@Query("api_key") String api_key,@Query("page") int page);
- }
- public class MovieDataRet {
- public int page;
- public int total_results;
- public int total_pages;
- public ArrayList<Movie> results;
- }
- ` MovieApi movieApi = ServiceGenerator.createService(MovieApi.class);
- Call<MovieDataRet> call= movieApi.getMovieList("popularity.desc", BuildConfig.MOVIE_DB_API_KEY, 1);
- try {
- MovieDataRet movies = call.execute().body();
- Log.d("QQQ", movies.toString());
- } catch (IOException e) {
- e.printStackTrace();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement