0

How can I add images to array list, and then add that array list to a view, in Android?

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.