i have a Problem with my Android Project,
AlertDialog.Builder localBuilder3 = new AlertDialog.Builder(testActivity.this); Error:(183, 30) error: not a statement Error:(183, 38) error: ';' expected
import android.app.AlertDialog.Builder;
is Grey, "Unused import Statement"
label422: AlertDialog.Builder localBuilder15 = new AlertDialog.Builder(testActivity.this);
localBuilder15.setTitle("Test!");
localBuilder15.setMessage("Test Save");
localBuilder15.setIcon(2130837510);
localBuilder15.setPositiveButton("Save", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface paramDialogInterface, int paramInt)
{
Toast.makeText(testActivity.this.getApplicationContext(), "Test wird gespeichert!", 0).show();
TestActivity.this.result = TestActivity.this.abfrage;
new TestActivity.SaveProductDetails(TestActivity.this).execute(new String[0]);
}
});
localBuilder3.setNegativeButton("Ohne Änderung speichern", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface paramDialogInterface, int paramInt)
{
Toast.makeText(TestActivity.this.getApplicationContext(), "test wird nicht gespeichert!", 0).show();
TestActivity.this.result = TestActivity.this.txtSafe.getText().toString();
new TestActivity.SaveProductDetails(TestActivity.this).execute(new String[0]);
}
});
localBuilder15.show();
A label can precede only a statement, not a declaration.
Since in this statement you both declare and initialize a variable, it is considered a declaration, not a statement, so the label becomes illegal.
If you want to put a label on the part of the line that is currently the initialization, you should use:
AlertDialog.Builder localBuilder15;
label422: localBuilder15 = new AlertDialog.Builder(testActivity.this);
This way, your label marks a statement, not a declaration.
But of course, as you have already been told, the label is simply superfluous here. If you don't have any break
statements within your statement, it's simply not useful.
Note:
goto
in Java, so labels can't be used as jump targets. break
statement. The statement marked by the label is always just the one that follows it up to the next ;
, or if the label marks a compound statement, its ending }
. So the label you created only marks the new
statement, and no break
statement in the statements after that will be in its scope.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.