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
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
//...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With