So I'm trying to create a grid of cells that can each as as their own onTouch object. I'm having a lot of issues but the main one is this exception that occurs while trying to populate the columns and rows of cells. Right now I'm trying to implement a Try/Catch method to resolve it but no luck yet. I thought maybe if I subtract from (j), the number of columns, it might stop the last two columns from populating (realistically I knew that wouldn't work).
Anyway, here's the code:
// creates cells
NavCell[][] mCells = new NavCell[mCellCols][mCellRows];
//System.out.println( "Rows " + mCellRows + " and Cols: " + mCellCols);
for (int j = 0; j < 18; j++)
{
    System.out.println("inside rows       " + j);
    if (mCells[j] != null)
    {
        for (int i = 0; i < mCellCols; i++)
        {
            System.out.println("inside columns      " + i);
            mCells[j][i] = new NavCell();
            mCells[j][i].setBounds(
                i * CELL_SIZE,
                j * CELL_SIZE,
                (i * CELL_SIZE) + CELL_SIZE,
                (i * CELL_SIZE) + CELL_SIZE);
            // drawCells(i, j);
            // System.out.println( "Lazer-3 " + CELL_SIZE);
            // System.out.println( "Lazer-4 " + i);
            System.out.println("Hello Dude" + j );
            Canvas canvas = new Canvas();
            drawCells(canvas, j, i);
        }
        try {
            int Z = j - 2;
            j = Z;
            System.out.println("Hello Matt" + j );
        } catch (ArrayIndexOutOfBoundsException e) {
            Log.e("MainActivity", "Reading list of NavCells failed!", e);
        }
    }
    System.out.println("Lazer-2 " + mCells);
}
 
     
    