Let's say I have a few buttons in a LinearLayout, 2 of them are:
mycards_button = ((Button)this.findViewById(R.id.Button_MyCards)); exit_button = ((Button)this.findViewById(R.id.Button_Exit));
I register setOnClickListener() on both of them:
mycards_button.setOnClickListener(this); exit_button.setOnClickListener(this);
How do I make a SWITCH to differentiate between the two buttons within the Onclick ?
public void onClick(View v) {
switch(?????){ case ???: /** Start a new Activity MyCards.java */ Intent intent = new Intent(this, MyCards.class); this.startActivity(intent); break;
case ???:
/** AlerDialog when click on Exit */
MyAlertDialog();
break; }