So for an app I’m making I am converting a 2d array of integer values into blocks(squares) of color in an imageview in a layout where each value (0,1,2,3..) corresponds to a color for their square (red, green blue…). I have almost zero experience with bitmaps and am running into some difficulties in making one. The first issue I am running into is creating the bitmap. The method I’m looking at is: bitmap.createBitmap(sizex, sizey, config) because this would allow me to make it the size (x and y) of pixels that the View is, but I cant figure out how to use the config class(it wont let me pass a config without giving me “static” errors. How can instantiate a bitmap this way?
Or am I barking up the wrong tree? Is there an easier way to do this (I’ve seen some people talk about android.graphics.canvas)? Any help or ideas is much appreciated, and please remember I new at anything graphics and might take some extra explanation.
Thanks
Try
Bitmap image = Bitmap.createBitmap(sizex, sizey, config);. Since the method is static, you call it from the class and not an existing object of the class.