I have a radiogroup and according to one condition must be selected one or the other. How do I get it to scale to the screen as described below? Code:
private RadioGroup mSwitchButtonGroup;
private boolean mGoesByCar;
private User user;
.....
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_confirm_routine, container, false);
user = new User();
mSwitchButtonGroup = (RadioGroup)view.findViewById(R.id.switch_rider_button);
if (user.hasCar()){
mSwitchButtonGroup -> R.id.goes_by_car deve aparecer checked
}else {
mSwitchButtonGroup -> R.id.doesnt_go_by_car deve aparecer checked
}
......
if(mSwitchButtonGroup!=null){
mSwitchButtonGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if(checkedId == R.id.goes_by_car){
mGoesByCar = true;
}else if(checkedId == R.id.doesnt_go_by_car){
mGoesByCar = false;
}
}
});
}
....
I hope I have been clear. Thank you!