b1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { Log.i("msg0", b+" "); if(b) { String text = b1.getText().toString(); Log.i("msg", text); } } });
b1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { Log.i("msg0", b); if(b) { String text = b1.getText().toString(); Log.i("msg", text); } } });
上下有段代码有一处不同(第四行的b),为什么上面的可行,下面不可行。
一条小咸鱼