This is my code:
boolean startGameBoolean;
Bundle extras = getIntent().getExtras();
extras.getInt("startGameBoolean");
if (startGameBoolean = true){
counter.start();
}
Eclipse gives a warning that “The local variable startGameBoolean is never read”; but it is.
I get the boolean from an another intent.
I edited my code, I missed some of it, sorry!
Shouldn’t it be
startGameBoolean = extras.getBoolean("startGameBoolean");?in the code you gave,
boolean startGameBoolean;is not used anywhere. the warning means that although you declared it, it is not used in the block where it lives, therefore could (should) be removed.Edit:
After seeing your addition, you use
startGameBoolean, but you assign to it, while you should compare to it:Also, assign the result of
getBoolean()to the variable as I wrote in the first statement.