Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created July 26, 2020 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelseatroy/49400148fd5132d3189f16f57345f318 to your computer and use it in GitHub Desktop.
Save chelseatroy/49400148fd5132d3189f16f57345f318 to your computer and use it in GitHub Desktop.
Extracting Responses
...
private String extractResponseFor(View view) {
RadioGroup options = (RadioGroup) view.findViewById(R.id.radio_group);
int selection = options.getCheckedRadioButtonId();
if (selection == -1) {
options.setBackgroundColor(getActivity().getResources().getColor(R.color.form_validation));
isFormValid = false;
return getString(R.string.unknown);
} else {
options.setBackgroundColor(0);
RadioButton button = (RadioButton) view.findViewById(selection);
return button.getText().toString();
}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment