我想在android中检查radiogroup为空或null,即提交而不点击该组中的任何单选按钮?
xml代码
<RadioGroup
android:id="@+id/lift"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<RadioButton
android:paddingRight="50dip"
android:textSize="20dp"
android:id="@+id/r91"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/yes" />
<RadioButton
android:paddingRight="50dip"
android:textSize="20dp"
android:id="@+id/r92"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no" />
</RadioGroup>
活动代码
RadioGroup radioGroup1 = (RadioGroup) findViewById(R.id.lift);
if(radioGroup1=='NULL')
{
Toast.makeText(getApplOicationContext(),"first radiogroup is null",Toast.LENGTH_LONG).show();
}