Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); bitmap.setPixel(x, y, Color.RED);
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { if ((x + y) % 2 == 0) { bitmap.setPixel(x, y, Color.WHITE); } else { bitmap.setPixel(x, y, Color.BLACK); } } }In both examples, the java.android.graphics package library is used to create and manipulate the bitmap images, including the setPixel() method to change the color of individual pixels.