片段代码
//获取电影海报
String urlPOster = null;
if (currentMovies.has(KEY_POSTER)) {
urlPOster = currentMovies.getString(URL_POSTER +KEY_POSTER);
}
URL_POSTER 和 KEY_POSTER
公共静态最终字符串 KEY_POSTER="poster_path";
公共静态最终字符串 URL_POSTER="http://image.tmdb.org/t/p/w500";
tmdb 的 json 提要
results": [{
"adult": false,
"backdrop_path": "/o4I5sHdjzs29hBWzHtS2MKD3JsM.jpg",
"genre_ids":
[878,
28,
53,
12],
"id": 87101,
"original_language": "en",
"original_title": "Terminator Genisys",
"overview": "The year is 2029. John Connor, leader of the resistance continues the war against the machines. At the Los Angeles offensive, John's fears of the unknown future begin to emerge when TECOM spies reveal a new plot by SkyNet that will attack him from both fronts; past and future, and will ultimately change warfare forever.",
"release_date": "2015-07-01",
"poster_path": "/5JU9ytZJyR3zmClGmVm9q4Geqbd.jpg",
"popularity": 55.202911,
"title": "Terminator Genisys",
"video": false,
"vote_average": 6.4,
"vote_count": 183},
这是我的适配器类
final String urlPoster=currentMovies.getUrlPOster();
if (urlPoster!=null){
imageLoader.get(urlPoster, new ImageLoader.ImageListener() {
@Override
public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {
holder.movieThumbnail.setImageBitmap(response.getBitmap());
}
@Override
public void onErrorResponse(VolleyError error) {
}
});