Ejemplo n.º 1
0
  // json数据解析映射到bean
  private void jsonToBean(String responseString) {
    Gson gson = new Gson();
    newsDetail = gson.fromJson(responseString, NewsDetail.class);
    final ImageLoader imageloader = ImageLoader.getInstance();
    DisplayImageOptions options =
        new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true).build();
    if (listEntity.getPhoto() != null) {
      if (listEntity.getTime().substring(2, 4).equals("15")) {
        imageloader.displayImage(
            Constants.BASE_PICURL + "2015/" + listEntity.getPhoto(), iv_toolBar, options);
      } else if (listEntity.getTime().substring(2, 4).equals("16")) {
        imageloader.displayImage(
            Constants.BASE_PICURL + "2016/" + listEntity.getPhoto(), iv_toolBar, options);
      }

    } else {
      imageloader.displayImage("drawable://" + R.drawable.banner_01, iv_toolBar, options);
    }
    textView_newsDetail.setText(newsDetail.getArticle().getContent());
    collapsingToolbarLayout.setTitle(newsDetail.getArticle().getTitle());
  }