Android 如何在数组中存储URL中的图像

Android 如何在数组中存储URL中的图像,android,arrays,android-internet,Android,Arrays,Android Internet,我想将URL中的图像存储在数组中,但我不知道如何实现此功能 就像我在数组中存储drawable中的图像一样,我想在URL中的数组中存储图像 可拉伸的示例: 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_

我想将URL中的图像存储在数组中,但我不知道如何实现此功能

就像我在数组中存储drawable中的图像一样,我想在URL中的数组中存储图像

可拉伸的示例:

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
    };
我试过了,但没用:

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

    };

您只需要存储图像的url

ArrayList<String> imagesFromURL = new ArrayList<String>();
//then do a loop over you urls and
imagesFromURL.add("some url here");
ArrayList imagesFromURL=new ArrayList();
//然后在URL和URL上做一个循环
添加(“此处的一些url”);

我是android新手,通过上网我找到了这个答案。制作一个位图数组,从url获取图像,然后在任何需要的地方使用它,从这个链接中获得想法[

使用上面的数组在imageview中显示它

imageView.setImageBitmap(mThumbIds[0]);

这样做:

ArrayList<Bitmap> imagesList= new ArrayList<Bitmap>();
//loop and download image and put it in this list
imagesList.add(bitmap);
ArrayList imagesList=新建ArrayList();
//循环并下载图像并将其放入此列表中
imagesList.add(位图);

只需首先从


然后
Picasso.with(context).load(“你的img url”)。进入(imageView);

不起作用意味着什么?你期望什么,发生了什么?最好的方法是将所有需要的图像url存储在一个数组中,然后使用Glide/Picasso将其加载到imageView或任何你需要的地方
ArrayList<Bitmap> imagesList= new ArrayList<Bitmap>();
//loop and download image and put it in this list
imagesList.add(bitmap);