所以我有了这段代码,并试图对其进行编辑以添加一个额外的按钮,但现在它不想运行。它和我以前的完全一样。我删除了新代码,但现在此代码不想运行。有小费吗?我在moveTo(activity)变量上遇到错误。与分号和方括号有关吗?我真的很困惑为什么它不起作用。
public class Main2Activity extends AppCompatActivity {
private Button B3;
private Button B4;
private Button B5;
private Button B6;
private Button B7;
private Button B25;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
B3 = findViewById(R.id.button3);
B3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
moveToDanceScheduleMenu();
}
});
B4 = findViewById(R.id.button10);
B4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
moveToWhatsOn();
}
});
B5 = findViewById(R.id.button11);
B5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
moveToMainResultsMenu();
}
});
B6 = findViewById(R.id.button12);
B6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
moveToSponsorsMenu();
}
});
B7 = findViewById(R.id.button6);
B7.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
moveToRulesAndRegs();
}
});
B25 = findViewById(R.id.button18);
B25.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
moveTomusic_submission();
}
});
private void moveTomusic_submission () {
Intent intent = new Intent(Main2Activity.this, music_submission.class);
startActivity(intent);
}
private void moveToDanceScheduleMenu () {
Intent intent = new Intent(Main2Activity.this, DanceScheduleMenu.class);
startActivity(intent);
}
private void moveToWhatsOn () {
Intent intent = new Intent(Main2Activity.this, WhatsOn.class);
startActivity(intent);
}
private void moveToMainResultsMenu () {
Intent intent = new Intent(Main2Activity.this, MainResultsMenu.class);
startActivity(intent);
}
private void moveToSponsorsMenu () {
Intent intent = new Intent(Main2Activity.this, SponsorsMenu.class);
startActivity(intent);
}
private void moveToRulesAndRegs () {
Intent intent = new Intent(Main2Activity.this, RulesAndRegs.class);
startActivity(intent);
}}}