问题
After parsing JSON array I'm getting image path How can I download that image and set it in list view.
JSONObject iobject = aJson.getJSONObject(0);
JSONObject imgObject = iobject.getJSONObject("img_update");
String img = imgObject.getString("0");
Here in string 'img' am getting image path How can I set it to a imageview in list what is simple and efficient solution for displaying those images in my android app as there will be hundreds of images.
following is my code in adapter class to set that image.There might be some error as its not working I read some tutorials related to this .
if(image != null) {
String img_path = "http://192.168.2.102/bootstrap/userapp_server/" + evnt.getEventImg();
File imgFile = new File(img_path);
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
image.setImageBitmap(myBitmap);
}
回答1:
You can use universal image loader liabrary for loading image from server they provided good implementation for loading and caching image. Find it here
来源:https://stackoverflow.com/questions/27054657/load-image-from-server-and-diaplay-in-listview