我有以下代码部分。应该用什么方法代替当地的36?
public void Alert()
{
AlertDialog.Builder localBuilder1 = new AlertDialog.Builder(this);
AlertDialog.Builder localBuilder2 = localBuilder1.setMessage("You lost").setCancelable(false);
36 local36 = new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface paramDialogInterface, int paramInt)
{
paramDialogInterface.cancel();
Pokemon.this.setContentView(2130903046);
Pokemon.this.mainmenu();
}
};
AlertDialog.Builder localBuilder3 = localBuilder2.setPositiveButton("OK", local36);
AlertDialog localAlertDialog = localBuilder1.create();
this.alert = localAlertDialog;
this.alert.show();
}
答案 0 :(得分:4)
我希望原始代码看起来像这样:
AlertDialog.Builder localBuilder3 =
localBuilder2.setPositiveButton
(
"OK",
new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface paramDialogInterface, int paramInt)
{
paramDialogInterface.cancel();
Pokemon.this.setContentView(2130903046);
Pokemon.this.mainmenu();
}
}
);
而不是有两个单独的陈述。所以36
不在原始代码中;它代表匿名内部类的名称。