Bitmap.createBitmap(black_to_white, 256, 1, Bitmap.Config.ARGB_8888)
should work.
Вопрос
I have an array of ARGB pixels:
for(int i = 0; i < 256; i++)
{
black_to_white[i] = 0xFF000000 | (i << 0) | (i << 8) | (i << 16);
}
I need from this create Bitmap that in result should look like this:
How from this integer array I crate an image to put inside imageview?
I have tried:
int width = 256
int height = 1
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.setPixels(array, 0, width, 0, 0, width, height);
Решение
Bitmap.createBitmap(black_to_white, 256, 1, Bitmap.Config.ARGB_8888)
should work.