-1

I am new to Android. Can you give me a hand ? Thanks

I download the sample project from https://github.com/nostra13/Android-Universal-Image-Loader

What I Would like to do id to load all the images URLs from a API using Json. In my Json File It has only one Array with all the URL.

I know ho to access the Json. But I download know to to load all the data data into this UIL Project.

Can you advice me what is the best way. Many Thanks:

Here is the Json data :

{
   "status":"success",
   "data":[
      "http:\/\/1.bp.blogspot.com\/-W4xhACvDOzo\/UKpj8csdb‌​WI\/AAAAAAAAFjU\/N4IxqdiEOR8\/s1600/farrari-sports-cars-13821367-1280-960.jpg",
      "http:\/\/1.bp.blogspot.com\/-W4xhACvDOzo\/UKpj8csdbWI\/AAAAAAAAFjU\/N4IxqdiEOR8‌​\/s1600/farrari-sports-cars-13821367-1280-960.jpg",
      "http:\/\/1.bp.blogspot.com\/-W4xhACvDOzo\/UKpj8csdbWI\/AAAAAAAAFjU\/N4IxqdiEOR8‌​\/s1600/farrari-sports-cars-13821367-1280-960.jpg"
   ]
}
Cho Hee
  • 165
  • 1
  • 11

2 Answers2

0

I would recommend you to use Gson to deserialize the Json in to object or pojo's and then play with them, also did you check Picasso i'm using that library for a production project and i really like it, cheers.

Baniares
  • 525
  • 1
  • 3
  • 9
0

Just use it like this.

ImageLoader.getInstance().displayImage(urlString, imageView);

If you want to show a loading image while image is loading, use memory cache etc use the DisplayOptions and pass it as a third parameter.

DisplayImageOptions displayOptions = new DisplayImageOptions.Builder()
            .resetViewBeforeLoading(true)
            .imageScaleType(ImageScaleType.EXACTLY)
            .cacheInMemory(true)
            .build();

And use ImageLoader.getInstance().displayImage(urlString, imageView,displayOptions);

Before using this you must initialize the ImageLoader by

ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).build();
    ImageLoader.getInstance().init(config);
Monster Brain
  • 1,950
  • 18
  • 28