/**
   * The system calls this to perform work in the UI thread and delivers the result from
   * doInBackground()
   */
  protected void onPostExecute(final Article result) {
    // Preserve aspect ratio of image
    i.setScaleType(ImageView.ScaleType.CENTER_CROP);
    i.setCropToPadding(true);

    // Set downloaded bitmap
    i.setImageBitmap(result.getBitmap());

    // When clicked, should open webview to article
    i.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent articlePageIntent =
                new Intent(mCWrapper, ArticleActivity.class)
                    .putExtra(Intent.EXTRA_HTML_TEXT, result.getLink())
                    .putExtra(Intent.EXTRA_SHORTCUT_NAME, result.getTitle());
            mFragment.startActivity(articlePageIntent);
          }
        });

    // Title
    textView.setText(result.getTitle());

    // Remove loading bar
    progressBar.setVisibility(ProgressBar.GONE);

    // Make title visible
    textView.setVisibility(TextView.VISIBLE);

    // Save new data to HeadlineFragment
    mFragment.setArticle(result);
  }
  /**
   * The system calls this to perform work in a worker thread and delivers it the parameters given
   * to AsyncTask.execute()
   */
  protected Article doInBackground(Integer... headlinePageNumber) {
    // Get basic article info from internet
    Article article = FetchHeadlineArticles.getArticles("featured", headlinePageNumber[0]);

    try {
      byte[] bytes;

      // Lowers resolution of images by subsampling image, saves memory & time
      BitmapFactory.Options a = new BitmapFactory.Options();
      a.inSampleSize = 1;

      // Download image from website
      InputStream in = new URL(article.getImageURL()).openStream();

      // Save bitmap here
      article.setBitmap(BitmapFactory.decodeStream(in, null, a));
    } catch (IOException e) {
      Log.e("HEADLINE IMAGE DOWNLOAD", e.getMessage());
    }

    return article;
  }