I would like to know how to make a spinner's event change a radiobutton visible or invisible. I have the following code. But it is not working.
<RadioGroup
android:id="@+id/radioGrupo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:orientation="horizontal">
<RadioButton
android:id="@+id/radioUsuario"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:onClick="onRadioButtonClicked"
android:text="Usuário" />
<RadioButton
android:id="@+id/radioNaoUsuario"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onRadioButtonClicked"
android:visibility="invisible"
android:text="Não usuário" />
</RadioGroup>
private void ExibeUsuarioNaoUsuario()
{
naoUsuario =(RadioButton) findViewById(R.id.radioNaoUsuario);
usuario =(RadioButton) findViewById(R.id.radioUsuario);
groupUsuarioNaoUsuario =(RadioGroup)findViewById(R.id.radioGrupo);
spnTipoCliente = (Spinner)findViewById(R.id.spnTipoCliente);
spnTipoCliente.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) {
groupUsuarioNaoUsuario.setVisibility(RadioGroup.VISIBLE);
//usuario.setVisibility(RadioButton.VISIBLE);
//naoUsuario.setVisibility(RadioButton.VISIBLE);
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
usuario.setVisibility(RadioButton.INVISIBLE);
naoUsuario.setVisibility(RadioButton.INVISIBLE);
}
});
}