2017-09-03 128 views
0

我有一個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

回答