Android中关于多个按钮放在一起操作的方法

关于多个按键放在一起操作的方法:

public class Sudoku extends Activity implements OnClickListener{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.main);
     super.onCreate(savedInstanceState);      
               
        View continueButton=this.findViewById(R.id.continue_button);
        continueButton.setOnClickListener(this);
        View newButton =this.findViewById(R.id.new_button);
        newButton.setOnClickListener(this);
        View aboutButton=this.findViewById(R.id.about_button);
        aboutButton.setOnClickListener(this);
        View exitButton=this.findViewById(R.id.exit_button);
        exitButton.setOnClickListener(this);
              
    }  
    public void onClick(View v)
    {
     switch(v.getId()){
     case R.id.about_button:
      Intent i=new Intent(this,About.class);
      startActivity(i);
原文地址:https://www.cnblogs.com/yejiurui/p/3012668.html