如題 先上程式碼
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
abc();
cde();
}
public void abc(){
CheckBox Checkboxa =(CheckBox) findViewById(R.id.checkBox1);
CheckBox Checkboxb =(CheckBox) findViewById(R.id.checkBox2);
CheckBox Checkboxc =(CheckBox) findViewById(R.id.checkBox3);
CheckBox Checkboxd =(CheckBox) findViewById(R.id.checkBox4);
CheckBox Checkboxe =(CheckBox) findViewById(R.id.checkBox5);
CheckBox Checkboxf =(CheckBox) findViewById(R.id.checkBox6);
Button buttona = (Button) findViewById(R.id.button1);
}
public void cde(){
Checkboxa.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener()
{
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if(Checkboxa.isChecked()){
Toast.makeText(MainActivity.this, "你選擇了"+Checkboxa.getText(),
Toast.LENGTH_LONG).show();
在編譯時cde涵式裡面的 Checkboxa 無法用到abc裡面的定義 請問是哪裡出了問題
新手發問請多多包涵