I am fairly new with android development. I am trying to take a 8x8 array of integers and make a 8x8 square (64 squares) using canvas and bitmap, a picture below shows what I want to accomplish. Each square would correspond to the index of the integer array, and the color of the square will change depending on the integers(0-255).
Currently, I am just trying to draw the layout of my application, but I am stuck on drawing the array of squares using canvas and bitmap. I have looked at different sources and the following two seems like very close to what I want to do.
source 1: I declared a 2d bitmap variable like this: Bitmap bmp[][] = new Bitmap[8][8]
and tried to use a double for loop, but my app crashes because of
Boolean android.graphics.Bitmap.isRecycled() on a null reference
source 2 I tried alexander zak's answer but I am not sure how to draw squares on to the screen using the Bitmap return value.
Any one have any suggestions on how I can accomplish my goal? thanks for all your help.