Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. private static Retrofit.Builder builder =
  2. new Retrofit.Builder()
  3. .baseUrl(API_BASE_URL)
  4. .addConverterFactory(GsonConverterFactory.create());
  5.  
  6. page: 1,
  7. results: [
  8. {
  9. poster_path: "/sdfsdf.jpg",
  10. adult: false,
  11. overview: "Based upon Marvel Comicsโ€™ most unconventional anti-hero, DEADPOOL tells the orig.",
  12. release_date: "2016-02-09",
  13. genre_ids: [
  14. 35,
  15. 12,
  16. 28,
  17. 878
  18. ]
  19. }],
  20. total_results: 254975,
  21. total_pages: 12749
  22.  
  23. public interface MovieApi {
  24. @GET("3/discover/movie")
  25. Call<MovieDataRet> getMovieList(@Query("sort_by") String sort,@Query("api_key") String api_key,@Query("page") int page);
  26.  
  27. }
  28.  
  29. public class MovieDataRet {
  30. public int page;
  31. public int total_results;
  32. public int total_pages;
  33. public ArrayList<Movie> results;
  34. }
  35.  
  36. ` MovieApi movieApi = ServiceGenerator.createService(MovieApi.class);
  37. Call<MovieDataRet> call= movieApi.getMovieList("popularity.desc", BuildConfig.MOVIE_DB_API_KEY, 1);
  38. try {
  39.  
  40. MovieDataRet movies = call.execute().body();
  41. Log.d("QQQ", movies.toString());
  42. } catch (IOException e) {
  43. e.printStackTrace();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement