11
Android OnClickListener - ระบุปุ่ม
ฉันมีกิจกรรม: public class Mtest extends Activity { Button b1; Button b2; public void onCreate(Bundle savedInstanceState) { ... b1 = (Button) findViewById(R.id.b1); b2 = (Button) findViewById(R.id.b2); b1.setOnClickListener(myhandler); b2.setOnClickListener(myhandler); ... } View.OnClickListener myhandler = new View.OnClickListener() { public void onClick(View v) { // MY QUESTION STARTS HERE!!! // IF b1 do this …