如何使用json下载这些网址图片?
这是我的图像URL,我想下载并显示这些图像。我如何recyclerview?我的模式是什么?如何逐步下载图像?我将这些链接保存在mysql db中,并通过json显示了它们,如下所示。希望我能表达我的意思,对英语感到抱歉。
这是我的json代码:
{
"images url": [
{
"id": "1",
"url": "http://mehrsoftshop.ir/images/mobile-1.jpg",
"discount_code": "0",
"price": "0",
"details": "",
"points": "0",
"is_found": "0"
},
{
"id": "2",
"url": "http://mehrsoftshop.ir/images/mobile-2.jpg",
"discount_code": "0",
"price": "0",
"details": "",
"points": "0",
"is_found": "0"
},
{
"id": "3",
"url": "http://mehrsoftshop.ir/images/mobile-3.jpg",
"discount_code": "0",
"price": "0",
"details": "",
"points": "0",
"is_found": "0"
},
{
"id": "4",
"url": "http://mehrsoftshop.ir/images/mobile-4.jpg",
"discount_code": "0",
"price": "0",
"details": "",
"points": "0",
"is_found": "0"
},
{
"id": "5",
"url": "http://mehrsoftshop.ir/images/mobile-5.jpg",
"discount_code": "0",
"price": "0",
"details": "",
"points": "0",
"is_found": "0"
},
{
"id": "6",
"url": "http://mehrsoftshop.ir/images/mobile-6.jpg",
"discount_code": "0",
"price": "0",
"details": "",
"points": "0",
"is_found": "0"
},
{
"id": "7",
"url": "http://mehrsoftshop.ir/images/mobile-7.jpg",
"discount_code": "0",
"price": "0",
"details": "",
"points": "0",
"is_found": "0"
},
]
}
答案 0 :(得分:0)
使用Glide和Picasso将图像加载到活动中。
Glide.with(context).load("url").into(imageView);
使用Retrofit或Asynctask解析JSON。创建一个Recycler视图,并在Adapter类的onBindViewHolder方法中,尝试以下代码。 有关更多参考,请签出此存储库。 Click here