gpt4 book ai didi

java - 如何从 tmdb json feed 加载电影图像

转载 作者:行者123 更新时间:2023-11-30 02:01:58 24 4
gpt4 key购买 nike

fragment 代码

//获取电影海报

                String urlPOster = null;

if (currentMovies.has(KEY_POSTER)) {

urlPOster = currentMovies.getString(URL_POSTER +KEY_POSTER);
}

URL_POSTER 和 KEY_POSTER

public static final String KEY_POSTER="poster_path";

public static final String 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) {

}
});

最佳答案

建议 Glide , 你可以载入你的网址。

ImageView imageView = (ImageView) findViewById(R.id.you_image_view);
Glide.with(this)
.load("http://image.tmdb.org/t/p/w500/o4I5sHdjzs29hBWzHtS2MKD3JsM.jpg")
.into(imageView);

关于java - 如何从 tmdb json feed 加载电影图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31317350/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com