Im trying to draw a grid of cells for a game of life application. In my onDraw method of a class extending View I have the following code:

   boolean[][] board = new boolean[9][6];  
   int gm = 100

    for(int r = 0 ; r < board.length; r++) //0-8
    {
        for(int c = 0; c < board[0].length; c++) //0-5
        {   
            int left = c*gm; 
            int top = r*gm; 
            int right = left + gm;
            int bottom = top + gm;                                      
            canvas.drawRect(new Rect(left, top, bottom, right), paintGrid);; //paints dead Cell
        }

    }

Instead of drawing a grid a 9x6 grid made of 100x100 dimension rectangles its draws a diagonal line of rectangles from the origin down. I have no clue why. What am I missing? Thanks in advance!

Related posts

Recent Viewed