RadioGroup rg = (RadioGroup)findViewById(R.id.youradio); String radiovalue = ((RadioButton)findViewById(rg.getCheckedRadioButtonId())).getText().toString();
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (DEBUG) Log.d(TAG, "onItemSelected() called with: parent = [" + parent + "], view = [" + view + "], position = [" + position + "], id = [" + id + "]"); switch (radioVideoAudioGroup.getCheckedRadioButtonId()) { case R.id.audio_button: selectedAudioIndex = position; break; case R.id.video_button: selectedVideoIndex = position; break; case R.id.subtitle_button: selectedSubtitleIndex = position; break; } }
// 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) { updateUI(group, screenStyleGroup.getCheckedRadioButtonId()); }
/** * getPriority is called whenever the selected priority needs to be retrieved */ public int getPriorityFromViews() { int priority = 1; int checkedId = ((RadioGroup) findViewById(R.id.radioGroup)).getCheckedRadioButtonId(); switch (checkedId) { case R.id.radButton1: priority = PRIORITY_HIGH; break; case R.id.radButton2: priority = PRIORITY_MEDIUM; break; case R.id.radButton3: priority = PRIORITY_LOW; } return priority; }
/** * getPriority is called whenever the selected priority needs to be retrieved */ public int getPriorityFromViews() { int priority = 1; int checkedId = ((RadioGroup) findViewById(R.id.radioGroup)).getCheckedRadioButtonId(); switch (checkedId) { case R.id.radButton1: priority = PRIORITY_HIGH; break; case R.id.radButton2: priority = PRIORITY_MEDIUM; break; case R.id.radButton3: priority = PRIORITY_LOW; } return priority; }
/** * getPriority is called whenever the selected priority needs to be retrieved */ public int getPriorityFromViews() { int priority = 1; int checkedId = ((RadioGroup) findViewById(R.id.radioGroup)).getCheckedRadioButtonId(); switch (checkedId) { case R.id.radButton1: priority = PRIORITY_HIGH; break; case R.id.radButton2: priority = PRIORITY_MEDIUM; break; case R.id.radButton3: priority = PRIORITY_LOW; } return priority; }
/** * getPriority is called whenever the selected priority needs to be retrieved */ public int getPriorityFromViews() { int priority = 1; int checkedId = ((RadioGroup) findViewById(R.id.radioGroup)).getCheckedRadioButtonId(); switch (checkedId) { case R.id.radButton1: priority = PRIORITY_HIGH; break; case R.id.radButton2: priority = PRIORITY_MEDIUM; break; case R.id.radButton3: priority = PRIORITY_LOW; } return priority; }
/** * getPriority is called whenever the selected priority needs to be retrieved */ public int getPriorityFromViews() { int priority = 1; int checkedId = ((RadioGroup) findViewById(R.id.radioGroup)).getCheckedRadioButtonId(); switch (checkedId) { case R.id.radButton1: priority = PRIORITY_HIGH; break; case R.id.radButton2: priority = PRIORITY_MEDIUM; break; case R.id.radButton3: priority = PRIORITY_LOW; } return priority; }
/** * getPriority is called whenever the selected priority needs to be retrieved */ public int getPriorityFromViews() { int priority = 1; int checkedId = ((RadioGroup) findViewById(R.id.radioGroup)).getCheckedRadioButtonId(); switch (checkedId) { case R.id.radButton1: priority = PRIORITY_HIGH; break; case R.id.radButton2: priority = PRIORITY_MEDIUM; break; case R.id.radButton3: priority = PRIORITY_LOW; } return priority; }
/** * getPriority is called whenever the selected priority needs to be retrieved */ public int getPriorityFromViews() { int priority = 1; int checkedId = ((RadioGroup) findViewById(R.id.radioGroup)).getCheckedRadioButtonId(); switch (checkedId) { case R.id.radButton1: priority = PRIORITY_HIGH; break; case R.id.radButton2: priority = PRIORITY_MEDIUM; break; case R.id.radButton3: priority = PRIORITY_LOW; } return priority; }
public RadioGroupAssert hasCheckedRadioButtonId(int id) { isNotNull(); int actualId = actual.getCheckedRadioButtonId(); assertThat(actualId) // .overridingErrorMessage("Expected checked radio button ID <%s> but was <%s>.", id, actualId) // .isEqualTo(id); return this; } }
private CropOptions getCropOptions() { if (rgCrop.getCheckedRadioButtonId() != R.id.rbCropYes) { return null; } int height = Integer.parseInt(etCropHeight.getText().toString()); int width = Integer.parseInt(etCropWidth.getText().toString()); boolean withWonCrop = rgCropTool.getCheckedRadioButtonId() == R.id.rbCropOwn ? true : false; CropOptions.Builder builder = new CropOptions.Builder(); if (rgCropSize.getCheckedRadioButtonId() == R.id.rbAspect) { builder.setAspectX(width).setAspectY(height); } else { builder.setOutputX(width).setOutputY(height); } builder.setWithOwnCrop(withWonCrop); return builder.create(); }
public void sendTheMessage(View v) { Cursor c=(Cursor)contacts.getSelectedItem(); if (means.getCheckedRadioButtonId()==R.id.client) { Intent sms=new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:"+c.getString(2))); sms.putExtra("sms_body", msg.getText().toString()); startActivity(sms); } else { SmsManager .getDefault() .sendTextMessage(c.getString(2), null, msg.getText().toString(), null, null); } } }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { PreferenceManager.getDefaultSharedPreferences(getActivity()) .edit().putInt(getArguments().getString(ARG_TITLE), group .indexOfChild(group.findViewById(group .getCheckedRadioButtonId()))).commit(); } });
private void configTakePhotoOption(TakePhoto takePhoto) { TakePhotoOptions.Builder builder = new TakePhotoOptions.Builder(); if (rgPickTool.getCheckedRadioButtonId() == R.id.rbPickWithOwn) { builder.setWithOwnGallery(true); } if (rgCorrectTool.getCheckedRadioButtonId() == R.id.rbCorrectYes) { builder.setCorrectImage(true); } takePhoto.setTakePhotoOptions(builder.create()); }
private void configCompress(TakePhoto takePhoto) { if (rgCompress.getCheckedRadioButtonId() != R.id.rbCompressYes) { takePhoto.onEnableCompress(null, false); return; } int maxSize = Integer.parseInt(etSize.getText().toString()); int width = Integer.parseInt(etCropWidth.getText().toString()); int height = Integer.parseInt(etHeightPx.getText().toString()); boolean showProgressBar = rgShowProgressBar.getCheckedRadioButtonId() == R.id.rbShowYes ? true : false; boolean enableRawFile = rgRawFile.getCheckedRadioButtonId() == R.id.rbRawYes ? true : false; CompressConfig config; if (rgCompressTool.getCheckedRadioButtonId() == R.id.rbCompressWithOwn) { config = new CompressConfig.Builder().setMaxSize(maxSize) .setMaxPixel(width >= height ? width : height) .enableReserveRaw(enableRawFile) .create(); } else { LubanOptions option = new LubanOptions.Builder().setMaxHeight(height).setMaxWidth(width).setMaxSize(maxSize).create(); config = CompressConfig.ofLuban(option); config.enableReserveRaw(enableRawFile); } takePhoto.onEnableCompress(config, showProgressBar); }
private void fetchStreamsSize() { disposables.clear(); disposables.add(StreamSizeWrapper.fetchSizeForWrapper(wrappedVideoStreams).subscribe(result -> { if (radioVideoAudioGroup.getCheckedRadioButtonId() == R.id.video_button) { setupVideoSpinner(); } })); disposables.add(StreamSizeWrapper.fetchSizeForWrapper(wrappedAudioStreams).subscribe(result -> { if (radioVideoAudioGroup.getCheckedRadioButtonId() == R.id.audio_button) { setupAudioSpinner(); } })); disposables.add(StreamSizeWrapper.fetchSizeForWrapper(wrappedSubtitleStreams).subscribe(result -> { if (radioVideoAudioGroup.getCheckedRadioButtonId() == R.id.subtitle_button) { setupSubtitleSpinner(); } })); }
@Test public void checkedRadioButtonId() throws Exception { assertThat(radioGroup.getCheckedRadioButtonId()).isEqualTo(-1); radioGroup.check(99); assertThat(radioGroup.getCheckedRadioButtonId()).isEqualTo(99); }
@Test public void shouldInformRadioGroupThatItIsChecked() throws Exception { RadioButton radioButton1 = new RadioButton(context); radioButton1.setId(99); RadioButton radioButton2 = new RadioButton(context); radioButton2.setId(100); RadioGroup radioGroup = new RadioGroup(context); radioGroup.addView(radioButton1); radioGroup.addView(radioButton2); radioButton1.setChecked(true); assertThat(radioGroup.getCheckedRadioButtonId()).isEqualTo(radioButton1.getId()); radioButton2.setChecked(true); assertThat(radioGroup.getCheckedRadioButtonId()).isEqualTo(radioButton2.getId()); }