0

i want to store Images in array from URL but i don't know how to implement this functionality.

just like i stored images from drawable in array i want to store images in array from URL.

example of drawable:

public Integer[] mThumbIds = {
            R.drawable.pic_1, R.drawable.pic_2,
            R.drawable.pic_3, R.drawable.pic_4,
            R.drawable.pic_5, R.drawable.pic_6,
            R.drawable.pic_7, R.drawable.pic_8,
            R.drawable.pic_9, R.drawable.pic_10,
            R.drawable.pic_11, R.drawable.pic_12,
            R.drawable.pic_13, R.drawable.pic_14,
            R.drawable.pic_15
    };

i tried this but it didn't work:

public Integer[] mThumbIds = {
            R.string.http_icons_iconarchive_com_icons_martz90_circle_512_android_icon_png

    };
user3739970
  • 591
  • 2
  • 13
  • 28

4 Answers4

1

simply first download Lib from http://square.github.io/picasso/

then Picasso.with(context).load("your url of img").into(imageView);

Jaydip Jadhav
  • 12,179
  • 6
  • 24
  • 40
0

You just need to store the url of the image.

ArrayList<String> imagesFromURL = new ArrayList<String>();
//then do a loop over you urls and
imagesFromURL.add("some url here");
someguy234
  • 559
  • 4
  • 17
0

I'm new to android,through some net surfing i came up to this answer. Make a bitmap array to get the image from url and then use it where ever you need, got the idea from this link [Load image from url

Bitmap[] mThumbIds =new Bitmap[10];//for exapmle 10
URL url = new URL("Your URL");//image url is stored here
mThumbIds[0]= BitmapFactory.decodeStream(url.openConnection().getInputStream());//this line help to get the image(for given url) and store it in BitMapArray

usage of above array to display it in imageview

imageView.setImageBitmap(mThumbIds[0]);
Community
  • 1
  • 1
SaravanaRaja
  • 3,228
  • 2
  • 21
  • 29
0

Do something like this:

ArrayList<Bitmap> imagesList= new ArrayList<Bitmap>();
//loop and download image and put it in this list
imagesList.add(bitmap);
Roland Weisleder
  • 9,668
  • 7
  • 37
  • 59
rupesh jain
  • 3,410
  • 1
  • 14
  • 22