I am developing game, Initially I was using boolean while decalring arrays, latter it revealed that instead of using boolean I should use int in order to store state of game, When I replaced boolean with int my if statement shows type mismatch exception and The operator && is undefined for the argument type(s) boolean, int. Here is my if statement code.
int [][] dots
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
canvas.drawPaint(pBack);
for (int y = 0; y < numRows; y++)
{
canvas.drawLine(xStep, yCoords[y], numColumns * xStep, yCoords[y], pDot);
for (int x = 0; x < numColumns; x++)
{
if (y == 0)
{
canvas.drawLine(xCoords[x], yStep, xCoords[x], numRows * yStep, pDot);
}
if (dots[x][y])
{
boolean left = x > 0 && dots[x - 1][y];
boolean up = y > 0 && dots[x][y - 1];
if (left)
{
canvas.drawLine(xCoords[x], yCoords[y], xCoords[x - 1], yCoords[y], pLine);
}
if (up)
{
canvas.drawLine(xCoords[x], yCoords[y], xCoords[x], yCoords[y - 1], pLine);
}
if (left && up && dots[x - 1][y - 1])
{
canvas.drawCircle(xCoords[x] - xStep / 2, yCoords[y] - yStep / 2, 10, pLine);
}
}
}
}
for (int y = 0; y < numRows; y++)
{
for (int x = 0; x < numColumns; x++)
{
canvas.drawCircle(xCoords[x], yCoords[y], 20, pDot);
if (dots[x][y])
{
canvas.drawCircle(xCoords[x], yCoords[y], 15, pLine);
}
}
}
if (firstDotX != -1)
{
canvas.drawCircle(xCoords[firstDotX], yCoords[firstDotY], 25, pSelect);
}
}