tags:

views:

48

answers:

1

Hi sir

I am starting to game development adding bitmap images in to array list how can implemented

for(int i =0;i<9;i++)
{
  resizedBitmap[i] = Bitmap.createBitmap(bitmapOrg, (i%3)*newWidth, (i/3)*newHeight,newWidth, newHeight);            
}

Given 9 images are storing array list display random order how can implemented its urgent

+2  A: 

There are a number of ways you can achieve what you are attempting to achieve. One such way is to ditch the array, and use an ArrayList instead.

ArrayList<Bitmap> mBitmaps = new ArrayList<Bitmap>(9);
for (int i = 0; i < 9; i++)
{
    mBitmaps.add(Bitmap.createBitmap(bitmapOrg, (i % 3) * newWidth, (i / 3) * newHeight, newWidth, newHeight));
}

Collections.shuffle(mBitmaps);

for (int i = 0; i < 9; i++)
{
    Bitmap bitmap = mBitmaps.get(i));

    //Do something
    //...
}
nEx.Software
thank u very much sir , its working fine
narasimha