screenshot如何从多个无线电组中获取值以及如何解决仅返回第一个值的问题
public void onClick(View v) {
int widepart=radioWidePart.getCheckedRadioButtonId();
int jawShape=radioJawShape.getCheckedRadioButtonId();
int faceLength=radiofaceLength.getCheckedRadioButtonId();
RadioButton foreheard = (RadioButton)findViewById(widepart);
RadioButton cheekbones = (RadioButton)findViewById(widepart);
RadioButton pointy=(RadioButton)findViewById(jawShape);
RadioButton square=(RadioButton)findViewById(jawShape);
RadioButton flshort=(RadioButton)findViewById(faceLength);
RadioButton flaverage=(RadioButton)findViewById(faceLength);
if(foreheard.isChecked()){
if(pointy.isChecked()){
if(flshort.isChecked()){
Intent Intents=new Intent(form.this,heart.class);
startActivity(Intents);
setContentView(R.layout.activity_heart);
}
else if(flaverage.isChecked()){
Intent Intents=new Intent(getApplicationContext(),heart.class);
startActivity(Intents);
setContentView(R.layout.activity_heart);
}
}
final RadioGroup radioWidePart= (RadioGroup) findViewById(R.id.widestpart);
final RadioButton forehead=(RadioButton)findViewById(R.id.foreheard);
final RadioButton cheekbone=(RadioButton)findViewById(R.id.cheekbone);
final RadioGroup radioJawShape=(RadioGroup) findViewById(R.id.shapeOfJaw);
final RadioButton pointy=(RadioButton)findViewById(R.id.pointy);
final RadioButton square=(RadioButton)findViewById(R.id.square);
final RadioGroup radiofaceLength=(RadioGroup)findViewById(R.id.faceLength);
final RadioButton flshort=(RadioButton)findViewById(R.id.flshort);
Button btnSubmit=(Button) findViewById(R.id.btnSubmit);
btnSubmit.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
if(pointy.isChecked()){
Intent Intents= new Intent(form.this, heart.class);
startActivity(Intents);
}}