Q:

Android Bitmap Decode and Arrays

The following code is what I have pieced together from articles on here but im really stumped what next to try
ArrayList<Bitmap> bitmapArray = new ArrayList<Bitmap>();
        for (int i = 1; i < 4; i++){
            bitmapArray.add(BitmapFactory.decodeFile("/storage/emulated/0/Pictures/" + Global.svar7));
            canvas.drawBitmap(bitmapArray[i], 0, 0, null);
 }

Basically I am trying to draw 3 bitmaps to the canvas one below the other within a loop
This is the nearest I have got with just one error on the Canvas.drawBitmap line saying that bitmapArray[i] has the error

The type of the expression must be an array type but it resolved to ArrayList

I have search this error on here and can only find examples that include strings and setting controls
Any ideas? can you please point me in the right direction?
Your help is Greatly appreciated
Mark

A:

To access items in an ArrayList, use ArrayList.get():
canvas.drawBitmap(bitmapArray.get(i-1), 0, 0, null);

You'll need to subtract 1 from the index because you are starting your loop from 1 not 0.

