@OnCheckedChanged({R.id.searchRb1, R.id.searchRb2, R.id.searchRb3, R.id.searchRb4}) void onTagChecked(RadioButton searchRb, boolean checked) { if (checked) { unsubscribe(); adapter.setImages(null); swipeRefreshLayout.setRefreshing(true); search(searchRb.getText().toString()); } }
View child = radioGroup.getChildAt(i); if (child.getId() == checkedId && child instanceof RadioButton) { textObj = ((RadioButton)child).getText(); break;
@Override public void finish() { if (mIsCancelled) { setResult(RESULT_CANCELED); } else { RadioGroup group = (RadioGroup) findViewById(R.id.radioProfiles); int selectedId = group.getCheckedRadioButtonId(); RadioButton radioButton = (RadioButton) findViewById(selectedId); String action = radioButton.getText().toString(); final Intent resultIntent = new Intent(); if (!G.isProfileMigrated()) { int idx = group.indexOfChild(radioButton); resultIntent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE, PluginBundleManager.generateBundle(getApplicationContext(), idx + "::" + action)); } else { resultIntent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE, PluginBundleManager.generateBundle(getApplicationContext(), selectedId + "::" + action)); } resultIntent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_STRING_BLURB, action); setResult(RESULT_OK, resultIntent); } super.finish(); } }
public void toastInputs(View v) { int selected = rdgVal.getCheckedRadioButtonId(); RadioButton b = (RadioButton) findViewById(selected); String text = etVal.getText() + " | " + chkVal.isChecked() + " | " + b.getText(); Toast.makeText(this, text, Toast.LENGTH_SHORT).show(); }
@Override public void onClick(View view) { RadioButton rbAttribute = (RadioButton) gridView.findViewWithTag("rbAttribute" + currentPositionColor); for(int i=0;i<listColorSize;i++){ RadioButton rbAttributeAll = (RadioButton) gridView.findViewWithTag("rbAttribute" + i); rbAttributeAll.setChecked(false); } rbAttribute.setChecked(true); sendBrodcastReceiver(rbAttribute.getText().toString()); //Toast.makeText(context,rbAttribute.getText(),Toast.LENGTH_SHORT).show(); } }
@Override public void onClick(View v) { RadioButton r1 = (RadioButton) getView().findViewById(mLeft.getCheckedRadioButtonId()); int r1Value = Integer.parseInt(r1.getText().toString()); RadioButton r2 = (RadioButton) getView().findViewById(mRight.getCheckedRadioButtonId()); int r2Value = Integer.parseInt(r2.getText().toString()); mResult.setText(getString(R.string.contact_form_result_format, mName.getText(), mLastName.getText(), mDescr.getText(), r1Value + r2Value)); } }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == rb1.getId()) { addpsTv.setText(rb1.getText().toString()); alertDialog.dismiss(); } else { Toast.makeText(getContext(), "not support", Toast.LENGTH_SHORT).show(); } } });
public void verValores(View v) { int idRadioSelecionado = radioGroup.getCheckedRadioButtonId(); RadioButton radio = (RadioButton)findViewById(idRadioSelecionado); String habilitado = checkBox.isChecked() ? "Habilitado" : "Desabilitado"; String valor = "valor: "+ seekBar.getProgress(); String nome = "nome: "+ spinner.getSelectedItem().toString(); String opcao = "opcao: "+ radio.getText(); StringBuilder mensagem = new StringBuilder(); mensagem.append(habilitado).append("\n") .append(valor).append("\n") .append(nome).append("\n") .append(opcao); Toast.makeText(this, mensagem.toString(), Toast.LENGTH_SHORT).show(); } }
private int getType() { int selectedId = mType.getCheckedRadioButtonId(); RadioButton radioBtn = (RadioButton) findViewById(selectedId); return radioBtn.getText().toString() .equals(getString(R.string.radio_payment)) ? SmartcardApp.TYPE_PAYMENT : SmartcardApp.TYPE_OTHER; }
public void onRadioButtonClicked(View view) { // Is the button now checked? boolean checked = ((RadioButton) view).isChecked(); Settings settings = Settings.getInstance(); short ap = Short.parseShort(((RadioButton) view).getText().toString()); settings.setMagnetometer_period(ap); } }
public void onRadioButtonClicked(View view) { // Is the button now checked? boolean checked = ((RadioButton) view).isChecked(); Settings settings = Settings.getInstance(); short ap = Short.parseShort(((RadioButton) view).getText().toString()); settings.setAccelerometer_period(ap); } }
public void onRadioButtonClicked(View view) { // Is the button now checked? boolean checked = ((RadioButton) view).isChecked(); Settings settings = Settings.getInstance(); short ap = Short.parseShort(((RadioButton) view).getText().toString()); settings.setMagnetometer_period(ap); } }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { for (int i = 0; i < group.getChildCount(); i++) { RadioButton rb = (RadioButton) group.getChildAt(i); if (rb.getId() == checkedId) { type[0] = rb.getText().toString(); } } } });
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { int childCount = group.getChildCount(); for (int x = 0; x < childCount; x++) { RadioButton btn = (RadioButton) group.getChildAt(x); if (btn.getId() == checkedId) { selectedIME = inputMethodInfos.get(x).getId(); Log.i(Constants.TAG,"InputMethodActivity selected RadioButton: " + btn.getText().toString() + " x: " + x); runCommand("adb shell ime enable " + selectedIME + ";ime set " + selectedIME + ";exit"); } } } });
/** * 获取选中按钮的文本,未选中 返回 空字符串 */ public String getCheckedRadioButtonText() { if (getCheckedRadioButtonId() == -1) { return ""; } return ((RadioButton) findViewById(getCheckedRadioButtonId())).getText().toString(); }
@Override public void onClick(View v) { // retrieve the radio button that was selected int radioSelected = radiogroup.getCheckedRadioButtonId(); // get the text associated with that radioId RadioButton selected = (RadioButton) findViewById(radioSelected); // Show a toast /** * See the differences between the two toast below and try to * understand **/ // Toast.makeText(getBaseContext(), selected+"", // Toast.LENGTH_SHORT).show(); Toast.makeText(getBaseContext(), selected.getText(), Toast.LENGTH_SHORT).show(); } });
private void sendEditIdea() { String new_text = mIdeaField.getText().toString(); if (!new_text.equals("")) { if (mRadioGroup.getCheckedRadioButtonId() != -1) { View radioButton = mRadioGroup.findViewById(mRadioGroup.getCheckedRadioButtonId()); RadioButton btn = (RadioButton) mRadioGroup.getChildAt(mRadioGroup.indexOfChild(radioButton)); String selection = (String) btn.getText(); String new_note = mNoteField.getText().toString(); boolean new_later = mDoLater.isChecked(); int new_priority = Integer.parseInt(selection); mDbHelper.editEntry(mIdRecycler, new_text, new_note, new_priority, new_later); } mEditIdeaDialog.dismiss(); } else { mError.setVisibility(View.VISIBLE); } }
String getSelectedUrl() { View v = getView(); if (v != null) { final RadioGroup rg = getView().findViewById(R.id.intro_discover_radioGroup); int id = rg.getCheckedRadioButtonId(); final RadioButton rb = getView().findViewById(id); if (rb != null) { String url = (String) rb.getText(); if (url.equals(getString(R.string.intro_urlNotFound))) { return null; } return url; } } return null; }
@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() : ""; } }
/** * To modify theme */ public void setTheme() { MaterialDialog.Builder builder = createCustomDialogWithoutContent(mActivity, R.string.theme_edit); MaterialDialog materialDialog = builder.customView(R.layout.dialog_theme_default, true) .onPositive(((dialog, which) -> { View view = dialog.getCustomView(); RadioGroup radioGroup = view.findViewById(R.id.radio_group_themes); int selectedId = radioGroup.getCheckedRadioButtonId(); RadioButton radioButton = view.findViewById(selectedId); String themeName = radioButton.getText().toString(); saveTheme(mActivity, themeName); mActivity.recreate(); })) .build(); RadioGroup radioGroup = materialDialog.getCustomView().findViewById(R.id.radio_group_themes); RadioButton rb = (RadioButton) radioGroup.getChildAt(getSelectedThemePosition(mActivity)); rb.setChecked(true); materialDialog.show(); } }