I have the following code
image1.setOnClickListener(new View.OnClickListener() {
int randInt = new Random().nextDouble() < 0.5 ? 1 : 2;
if (randInt.equals(1)) {
public void onClick(View view) {
if (isFirstImage) {
applyRotation(0, 90);
applyRotation(0, 90);
isFirstImage = !isFirstImage;
} else {
applyRotation(0, -90);
applyRotation(0, -90);
isFirstImage = !isFirstImage;
}
}
} else if (randInt.equals(2)) {
public void onClick(View view) {
if (isFirstImage) {
applyRotation(0, 90);
applyRotation(0, 90);
applyRotation(0, 90);
isFirstImage = !isFirstImage;
} else {
applyRotation(0, -90);
applyRotation(0, -90);
applyRotation(0, -90);
isFirstImage = !isFirstImage;
}
}
}
});
I have a "Syntax error, insert ";" to complete Statement" on the line where I declare my integer, when I clearly do have a ";" there. I have a few "Syntax error on token "(",:expected" and "Syntax error on token ")",;expected" where I have "public void onClick(View view) {" I have a "Syntax error, insert "}" to complete Statement" but I looked everywhere and it seems I have closed all my statements.
I think Eclipse is giving me false errors, and I tried Project > Clean, but that didn't solve it. Please help, thanks!
.equalson an int. just use==