Reputation: 785
How can I add images to array list, and then add that array list to a view, in Android?
Upvotes: 0
Views: 2611
Reputation: 7067
I think that it would be better that you give more details about your problem such as how you get the images or how you are created your View. But I think that the code below will be useful for you.
ArrayList<Bitmap> mBitmaps = new ArrayList<Bitmap>(9);
for (int i = 0; i < mBitmaps.size; i++)
{
mBitmaps.add(Bitmap.createBitmap(Bitmap_src));
}
Collections.shuffle(mBitmaps);
for (int i = 0; i < mBitmaps.size; i++)
{
Bitmap bitmap = mBitmaps.get(i));
//Show image in an ImageView
//...
}
I send you an url about create and show BitMaps:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/CreateBitmap.html
Upvotes: 2