Android – Load Image in ImageView from URL stored in JSONString in Android


I have a JSON string, say a name and a Url . I need to extract name into the TextView and extract and display image in ImageView.
Below is the code for above scenario.

 public static final String JSON_STRING="{\"WebImages\":{\"Imagename\":\"image_name\",\"imageurl\":}}"; 

I need to display the name in TextView which I created, and fetch the image from that url and display in the Imageview.

Best Solution

First of all use Gson to parse Json and get url as a String, then you can use UniversalImageLoader library (it does the async image download and very easy to use)

static public DisplayImageOptions options= new DisplayImageOptions.Builder().cacheOnDisk(true).cacheInMemory(true).build();
    imageLoader.displayImage(imgUrl, ivImage, options, new ImageLoadingListener() {

        public void onLoadingStarted(String imageUri, View view) {

        public void onLoadingFailed(String imageUri, View view, FailReason failReason) {

        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {


        public void onLoadingCancelled(String imageUri, View view) {