private void setRadioButtonsState(boolean enabled) { radioVideoAudioGroup.findViewById(R.id.audio_button).setEnabled(enabled); radioVideoAudioGroup.findViewById(R.id.video_button).setEnabled(enabled); radioVideoAudioGroup.findViewById(R.id.subtitle_button).setEnabled(enabled); }
// This will get the radiogroup RadioGroup rGroup = (RadioGroup)findViewById(r.id.radioGroup1); // This will get the radiobutton in the radiogroup that is checked RadioButton checkedRadioButton = (RadioButton)rGroup.findViewById(rGroup.getCheckedRadioButtonId());
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { PreferenceManager.getDefaultSharedPreferences(getActivity()) .edit().putInt(getArguments().getString(ARG_TITLE), group .indexOfChild(group.findViewById(group .getCheckedRadioButtonId()))).commit(); } });
// This overrides the radiogroup onCheckListener rGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { // This will get the radiobutton that has changed in its check state RadioButton checkedRadioButton = (RadioButton)group.findViewById(checkedId); // This puts the value (true/false) into the variable boolean isChecked = checkedRadioButton.isChecked(); // If the radiobutton that has changed in check state is now checked... if (isChecked) { // Changes the textview's text to "Checked: example radiobutton text" tv.setText("Checked:" + checkedRadioButton.getText()); } } });
protected void setupDownloadOptions() { setRadioButtonsState(false); final RadioButton audioButton = radioVideoAudioGroup.findViewById(R.id.audio_button); final RadioButton videoButton = radioVideoAudioGroup.findViewById(R.id.video_button); final RadioButton subtitleButton = radioVideoAudioGroup.findViewById(R.id.subtitle_button); final boolean isVideoStreamsAvailable = videoStreamsAdapter.getCount() > 0; final boolean isAudioStreamsAvailable = audioStreamsAdapter.getCount() > 0; final boolean isSubtitleStreamsAvailable = subtitleStreamsAdapter.getCount() > 0; audioButton.setVisibility(isAudioStreamsAvailable ? View.VISIBLE : View.GONE); videoButton.setVisibility(isVideoStreamsAvailable ? View.VISIBLE : View.GONE); subtitleButton.setVisibility(isSubtitleStreamsAvailable ? View.VISIBLE : View.GONE); if (isVideoStreamsAvailable) { videoButton.setChecked(true); setupVideoSpinner(); } else if (isAudioStreamsAvailable) { audioButton.setChecked(true); setupAudioSpinner(); } else if (isSubtitleStreamsAvailable) { subtitleButton.setChecked(true); setupSubtitleSpinner(); } else { Toast.makeText(getContext(), R.string.no_streams_available_download, Toast.LENGTH_SHORT).show(); getDialog().dismiss(); } }
radioGroup.findViewById(radioGroup.getCheckedRadioButtonId())); final AdapterChoiceItem choice = choices.get(indexOfChild);
@Override public void onCheckedChanged(RadioGroup radioGroup, int i) { View radioButton = radioGroup.findViewById(i); int index = radioGroup.indexOfChild(radioButton); String host = address[index]; SharedPreferences.Editor edit = mPrefs.edit(); edit.putString(Config.SP_SERVER_HOST, host); edit.apply(); } });
RadioGroup group= (RadioGroup) getView().findViewById(R.id.radioGroup); group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { View radioButton = radioGroup.findViewById(i); int index = radioGroup.indexOfChild(radioButton); } });
public void onCheckedChanged(RadioGroup group, int checkedId) { if (group.findViewById(checkedId).isPressed()) { //This will only execute if pressed. not if device rotates } }
private void getViews(View view) { mSearchRadio = (RadioGroup) view.findViewById(R.id.radioGroup); mTopicButton = (RadioButton) mSearchRadio.findViewById(R.id.search_topic); mAllTopicButton = (RadioButton) mSearchRadio.findViewById(R.id.search_alltopic); mUserTopicButton = (RadioButton) mSearchRadio.findViewById(R.id.search_user_topic); mUserReplyButton = (RadioButton) mSearchRadio.findViewById(R.id.search_user_apply); mEditText = (EditText) view.findViewById(R.id.search_data); mContentCheckBox = (CheckBox) view.findViewById(R.id.withcontent); }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { RadioButton checkedRadioButton = (RadioButton)group.findViewById(checkedId); int CorrectAnswer=Integer.parseInt(checkedRadioButton.getTag().toString()); ....your code here... }
private void getViews(View view) { mSearchRadio = (RadioGroup) view.findViewById(R.id.radioGroup); mSearchName = (RadioButton) mSearchRadio.findViewById(R.id.profilesearch_name); mSearchId = (RadioButton) view.findViewById(R.id.profilesearch_id); mEditText = (EditText) view.findViewById(R.id.search_data); }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { RadioButton checked = (RadioButton) group.findViewById(checkedId); mDevice = (BluetoothDevice) checked.getTag(); } });
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { String tag = (String) group.findViewById(checkedId).getTag(); loadingImageView.setMaskOrientation(Integer.parseInt(tag)); } });
@Override public void onCheckedChanged(RadioGroup radioGroup, int i) { vp.setCurrentItem(radioGroup.indexOfChild(radioGroup.findViewById(i))); } });
RadioGroup group= (RadioGroup) getView().findViewById(R.id.radioGroup); group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { View radioButton = radioGroup.findViewById(i); int index = radioGroup.indexOfChild(radioButton); } });
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { AppCompatRadioButton arb = group.findViewById(checkedId); System.out.println("6:" + arb); callback.onTimeChanged(arb.getText().toString()); } });
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { int index = mRadioGroup.indexOfChild(group.findViewById(checkedId)); ODataRow row = items.get(index); setValue(row.getInt(OColumn.ROW_ID)); }
@Override String getResult() { int radioIndex = radioGroup.indexOfChild(widgetView.findViewById(radioGroup.getCheckedRadioButtonId())); RadioButton radioButton = (RadioButton) radioGroup.getChildAt(radioIndex); InputResult.index = radioIndex; return (radioButton != null) ? radioButton.getText().toString() : ""; } }
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { RadioButton radioButton = (RadioButton) group.findViewById(checkedId); if(radioButton.getText().equals("yes")) { radioButton.setBackgroundColor(Color.GREEN); } else { radioButton.setBackgroundColor(Color.RED); } } });