RadioGroup rg;
rg = (RadioGroup) findViewById(R.id.radiogroup);
if(JK.equalsIgnoreCase("Perempuan")){
((RadioButton)rg.getChildAt(1)).setChecked(true);
}
else{//Laki-laki
((RadioButton)rg.getChildAt(0)).setChecked(true);
}
===========================
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Jenis Kelamin" android:textColor="#000000" android:textSize="20sp" android:textStyle="bold"/>
<RadioGroup android:id="@+id/radio" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical">
<RadioButton android:id="@+id/radPa" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Laki-laki" android:checked="true" />
<RadioButton android:id="@+id/radPi" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Perempuan" />
</RadioGroup>
Tidak ada komentar:
Posting Komentar