@Override
  protected PojoTrailers doInBackground(ArgsAsyncTrailers... params) {
    InputStream is = null;
    Context context = params[0].getContext();
    int movieId = params[0].getMovieId();

    MovieApi api = new MovieApi(context);

    try {
      URL url = api.getTrailersUrl(movieId);
      Log.d(CLASS_TAG, "myUrl:" + url.toString());

      HttpURLConnection conn = (HttpURLConnection) url.openConnection();
      conn.setReadTimeout(mTimeout);
      conn.setConnectTimeout(mTimeout);
      conn.setRequestMethod("GET");
      conn.setDoInput(true);
      conn.connect();
      int response = conn.getResponseCode();
      Log.d(CLASS_TAG, "The response is: " + response);
      is = conn.getInputStream();

      // Convert the InputStream into a string
      String contentAsString = readIt(is);

      Gson gson = new Gson();
      PojoTrailers trailers = gson.fromJson(contentAsString, PojoTrailers.class);

      Log.d(CLASS_TAG, "Trailer: " + trailers.getResults().size());

      return trailers;

      // Makes sure that the InputStream is closed after the app is
      // finished using it.
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      if (is != null) {
        try {
          is.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }

    return null;
  }
  private void setupMovieDetails() {
    // Title
    ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
    actionBar.setTitle(mMovie.title);

    // Text
    ((TextView) mDetailView.findViewById(R.id.fragment_detail_title)).setText(mMovie.title);
    ((TextView) mDetailView.findViewById(R.id.fragment_detail_release_date))
        .setText(mMovie.releaseDate);
    ((TextView) mDetailView.findViewById(R.id.fragment_detail_vote_average))
        .setText(
            getString(R.string.fragment_detail_rating_text, String.valueOf(mMovie.voteAverage)));
    ((TextView) mDetailView.findViewById(R.id.fragment_detail_synopsis))
        .setText(String.valueOf(mMovie.overview));

    // Set image
    mImage = (ImageView) mDetailView.findViewById(R.id.fragment_detail_image);
    String path = mAPi.getImgUrl(mMovie.posterPath, true);

    // Callback to activity to give go ahead to load.
    Picasso.with(getActivity())
        .load(path)
        .into(
            mImage,
            new Callback() {
              @Override
              public void onSuccess() {
                if (mCallback != null) {
                  mCallback.onMoviePosterLoaded(mImage);
                }
              }

              @Override
              public void onError() {
                if (mCallback != null) {
                  mCallback.onMoviePosterLoaded(mImage);
                }
              }
            });
  }