<CheckBox android:id="@+id/box1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/box1" /> <CheckBox android:id="@+id/box2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/box2" /> <CheckBox android:id="@+id/box3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/box3" /> private CheckBox box1; private CheckBox box2; private CheckBox box3; onCreate(){ box1 = (CheckBox) findViewById(R.id.box1); box2 = (CheckBox) findViewById(R.id.box2); box3 = (CheckBox) findViewById(R.id.box3); box1.setOnCheckedChangeListener(checkedListen); box2.setOnCheckedChangeListener(checkedListen); box3.setOnCheckedChangeListener(checkedListen); } private OnCheckedChangeListener checkedListen = new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton btn, boolean isChecked) { // TODO Auto-generated method stub if(isChecked){ Toast.makeText(TextViewActivity.this, btn.getText()+"选中", Toast.LENGTH_SHORT).show(); }else{ Toast.makeText(TextViewActivity.this, btn.getText()+"取消选中", Toast.LENGTH_SHORT).show(); } } };