如何将图像从url数组加载到图像数组?

问题描述:

我有一个url数组,我必须加载所有图像并将其放入图像数组中。如何将图像从url数组加载到图像数组?

我想这

ImageView tempImageView = (ImageView)findViewById(R.id.temp_image_view); 
     for (int j = 0; j < urls.length-1; j++){ 
      Picasso.with(getApplicationContext()).load(urls[j]).into(tempImageView); 
      image[j] = tempImageView.getDrawable(); 

     } 

,但它不能正常工作。我该怎么做?

+0

看:https://stackoverflow.com/questions/4201879/image-array-in-android –

+1

背后用毕加索的一点是要加载图像*异步* 。调用'getDrawable()'时,'tempImageView'不会有图像。 – CommonsWare

毕加索有一个oncompletion监听器。

检查这个答案

How to listen for Picasso (Android) load complete events?