After stripping out everything besides the control statements, this is what we’re left with:
public void onClick(View v)
{
if (id == R.id.button6)
{
//snip
}
else if (id == R.id.button1)
{
if (doubler == 0)
{
if (value > 1000)
{
//snip
}
else if (value < 1000)
{
//snip
}
}
}
if (doubler == 2)
{
if (value > 5000)
{
//snip
}
else if (value < 5000)
{
//snip
}
}
if (doubler == 3)
{
//snip
}
if (doubler == 1)
{
if (value > 2500)
{
//snip
}
else if (value < 2500)
{
//snip
}
}
else if (id == R.id.button2)
{
if (lives == 0)
{
if (value > 200)
{
//snip
}
if (value < 200)
{
//snip
}
}
}
if (lives == 1)
{
//snip
}
}
You’re correct about having misplaced closing braces. Move if (doubler == 2)
and if (doubler == 3)
to be inside of else if (id == R.id.button1)
and if (lives == 1)
inside of else if (id == R.id.button2)
and everything should work as intended.
Also, I would highly recommend using >=
instead of just >
in your value checks and moving your dialog code into a separate function instead of having duplicate code all over the place.
solved My shop buys other things because the brackets or the if inside if