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);
posted @ 2013-04-10 16:46  Andye  阅读(1536)  评论(0编辑  收藏  举报