public class GameView extends View {
private Bitmap bmp1;
private Bitmap bmp2;
private Bitmap bmp3;
private Bitmap bmp4;
private Bitmap bmp5;
private Bitmap bmp6;
public GameView(Context context) {
super(context);
bmp1 = BitmapFactory.decodeResource(getResources(),R.drawable.candy1);
bmp2 = BitmapFactory.decodeResource(getResources(),R.drawable.candy2);
bmp3 = BitmapFactory.decodeResource(getResources(),R.drawable.candy3);
bmp4 = BitmapFactory.decodeResource(getResources(),R.drawable.candy4);
bmp5 = BitmapFactory.decodeResource(getResources(),R.drawable.candy5);
bmp6 = BitmapFactory.decodeResource(getResources(),R.drawable.candy6);
//here my 6 images i made them in this way to control thier positions x,y
}
@Override
protected void onDraw(Canvas canvas){
Bitmap[] images = {bmp1 , bmp2 , bmp3 , bmp4 , bmp5 , bmp6};
canvas.drawColor(Color.WHITE);
for (int i = 0; i<306; i+=61)
{
canvas.drawBitmap(bmp1, i, 0, null);
canvas.drawBitmap(bmp2, i, 61, null);
canvas.drawBitmap(bmp3, i, 122, null);
canvas.drawBitmap(bmp4, i, 183, null);
canvas.drawBitmap(bmp5, i, 244, null);
canvas.drawBitmap(bmp6, i, 305, null);
//how to use collections.shuffle in the loop to insert the 6 images randomly , and insert the images with these positions , i made array of bitmap but how to use it in collections.shuffle so it can display my imgaes randomly with these postions ?
}
}
}