这是我的MainActivity中的一段代码所有它都是明文字段,但是我得到了这个错误并导致我的程序无法编译......它非常令人沮丧,因为它显示了唯一的lint错误...
}
public void onClick(View v) {
Intent intent = getIntent();
overridePendingTransition(0, 0);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
finish();
overridePendingTransition(0, 0);
startActivity(intent);
setContentView(R.layout.activity_main);
} //<---ERROR???????? syntax error on token "}", { expected
};
答案 0 :(得分:0)
不是说expected };
,这意味着你可能只是错过了分号。
答案 1 :(得分:0)
Ok got it I forgot to get new OnClickListener this fixed the formatting issue writing this line of code OnClickListener resetListener = new OnClickListener() {
OnClickListener resetListener = new OnClickListener() {
public void onClick(View v) {
Intent intent = getIntent();
overridePendingTransition(0, 0);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
finish();
overridePendingTransition(0, 0);
startActivity(intent);
setContentView(R.layout.activity_main);
}
};