我實現RadioGroup中在我的應用程序。爲此,我已導入import android.widget.RadioGroup
和implemented OnCheckedChangeListener
。不過還是我收到此錯誤:理由接受「RadioGroup中是不適用的論點」
The method setOnCheckedChangeListener(RadioGroup.OnCheckedChangeListener) in the type RadioGroup is not applicable for the arguments (OpenedClass)
的Java:
OpenedClass.java
public class OpenedClass extends Activity implements OnClickListener,OnCheckedChangeListener{
TextView tv1,tv2;
RadioGroup selectionList;
Button rtn;
String gotBread;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.send);
initlize();
Bundle gotBusket = getIntent().getExtras();
gotBread = gotBusket.getString("KEY");
tv1.setText(gotBread);
}
private void initlize() {
// TODO Auto-generated method stub
tv1 = (TextView)findViewById(R.id.tvQuestion);
tv2 = (TextView)findViewById(R.id.textView2);
rtn = (Button)findViewById(R.id.bReturn);
rtn.setOnClickListener(this);
selectionList = (RadioGroup)findViewById(R.id.rgAnswers);
selectionList.setOnCheckedChangeListener(this);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
@Override
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
// TODO Auto-generated method stub
switch(arg0.getId())
{
case R.id.rCrazy:
break;
case R.id.rSuper:
break;
case R.id.rBoth:
break;
}
}
}
啊.. :) – Lucifer
你可能想用Ctrl + Shift + O從時間你定的進口時間,如果使用Eclipse IDE – Neo
我可否知道這兩者之間有什麼區別? – user2235614