Java Code Examples for android.widget.RadioGroup#findViewById()
The following examples show how to use
android.widget.RadioGroup#findViewById() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewClickProbe.java From ans-android-sdk with GNU General Public License v3.0 | 6 votes |
@Override public void trackRadioGroup(RadioGroup parent, int checkedId, boolean hasTrackClickAnn,long currentTime) { try { if (isTrackClickSwitchClose()) { return; } Object pageObj = AllegroUtils.getPageObjFromView(parent); View childView = parent.findViewById(checkedId); if (!checkTrackClickEnable(pageObj, childView, hasTrackClickAnn) || !checkTrackClickEnable(pageObj, parent, hasTrackClickAnn)) { return; } Map<String, Object> elementInfo = new HashMap<>(); String[] viewTypeAndText = AllegroUtils.getViewTypeAndText(childView); elementInfo.put(Constants.ELEMENT_TYPE, viewTypeAndText[0]); elementInfo.put(Constants.ELEMENT_CONTENT, viewTypeAndText[1]); elementInfo.put(Constants.ELEMENT_POSITION, parent.indexOfChild(childView) + ""); autoTrackClick(pageObj, elementInfo, hasTrackClickAnn,currentTime); } catch (Throwable ignore) { ExceptionUtil.exceptionThrow(ignore); } }
Example 2
Source File: MainActivity.java From android-discourse with Apache License 2.0 | 6 votes |
protected void siteChanged(RadioGroup group, int checkedId) { if (checkedId == -1) { return; } RadioButton button = (RadioButton) group.findViewById(checkedId); Site site = (Site) button.getTag(); if (site != null) { App.setSiteUrl(site.getUrl()); } if (site == null) { group.clearCheck(); openSettingsActivity(); } else if (!site.getUrl().equals(mCurrentSiteUrl)) { // TODO 第一次启动 加载上次查看的url。 mDrawerPosition = ListView.INVALID_POSITION; mCurrentSite = site; mCurrentSiteUrl = site.getUrl(); PrefsUtils.setCurrentSiteUrl(mCurrentSiteUrl); App.setLogin(false); clearDatabase(); // 登陆完成后,再加载其他信息 loadUserInfo(site, false); } else { setupUserInfo(mUser); } getActionBar().setSubtitle(mCurrentSiteUrl); }
Example 3
Source File: HorizontalScrollMenu.java From HorizontalScrollMenu with Apache License 2.0 | 6 votes |
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub RadioButton btn = (RadioButton) group.findViewById(checkedId); setMenuItemsNullBackground(); btn.setBackgroundResource(mBackgroundResId); btn.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom); int position = 0; for (int i = 0; i < rb_items.size(); i++) { if (rb_items.get(i) == btn) { position = i; } } vp_content.setCurrentItem(position, mSwiped); moveItemToCenter(btn); mAdapter.onPageChanged(position, mVisitStatus[position]); mVisitStatus[position] = true; }
Example 4
Source File: MainActivity.java From AndroidDonate with MIT License | 5 votes |
@Override public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { RadioButton checkedRadioButton = (RadioButton) group.findViewById(checkedId); String text = checkedRadioButton.getText().toString().trim(); currentMoney = Integer.valueOf(text.replace("元", "").trim()); btAlipayCustom.setText("支付宝捐赠(" + currentMoney + "元)"); }
Example 5
Source File: ViewUtil.java From sa-sdk-android with Apache License 2.0 | 5 votes |
/** * 获取 view text */ public static String getViewContent(View view) { String value = ""; View selected = null; if (view instanceof RatingBar) { value = String.valueOf(((RatingBar) view).getRating()); } else if (view instanceof Spinner) { Object item = ((Spinner) view).getSelectedItem(); if (item instanceof String) { value = (String) item; } else { selected = ((Spinner) view).getSelectedView(); if ((selected instanceof TextView) && ((TextView) selected).getText() != null) { value = ((TextView) selected).getText().toString(); } } } else if (view instanceof SeekBar) { value = String.valueOf(((SeekBar) view).getProgress()); } else if (view instanceof RadioGroup) { RadioGroup group = (RadioGroup) view; selected = group.findViewById(group.getCheckedRadioButtonId()); if ((selected instanceof RadioButton) && ((RadioButton) selected).getText() != null) { value = ((RadioButton) selected).getText().toString(); } } else if (view instanceof TextView) { if (((TextView) view).getText() != null) { value = ((TextView) view).getText().toString(); } } if (TextUtils.isEmpty(value)) { if (view.getContentDescription() != null) { value = view.getContentDescription().toString(); } } return value; }
Example 6
Source File: TGTripletFeelDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public Integer parseTripletFeelValue() { RadioGroup radioGroup = (RadioGroup) this.getView().findViewById(R.id.triplet_feel_dlg_value); int radioButtonId = radioGroup.getCheckedRadioButtonId(); if( radioButtonId != -1 ) { RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId); if( radioButton != null ) { return ((Integer)radioButton.getTag()).intValue(); } } return TGMeasureHeader.TRIPLET_FEEL_NONE; }
Example 7
Source File: TGTremoloPickingDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public int findSelectedDuration() { RadioGroup optionsGroup = (RadioGroup) this.getView().findViewById(R.id.tremolo_picking_dlg_duration_group); int radioButtonId = optionsGroup.getCheckedRadioButtonId(); if( radioButtonId != -1 ) { RadioButton radioButton = (RadioButton) optionsGroup.findViewById(radioButtonId); if( radioButton != null ) { return ((Integer)radioButton.getTag()).intValue(); } } return TGDuration.EIGHTH; }
Example 8
Source File: TGTrillDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public int findSelectedDuration() { RadioGroup optionsGroup = (RadioGroup) this.getView().findViewById(R.id.trill_dlg_duration_group); int radioButtonId = optionsGroup.getCheckedRadioButtonId(); if( radioButtonId != -1 ) { RadioButton radioButton = (RadioButton) optionsGroup.findViewById(radioButtonId); if( radioButton != null ) { return ((Integer)radioButton.getTag()).intValue(); } } return TGDuration.EIGHTH; }
Example 9
Source File: ColorPickerPreference.java From AcDisplay with GNU General Public License v2.0 | 5 votes |
@NonNull @Override public MaterialDialog onBuildDialog(@NonNull MaterialDialog.Builder builder) { MaterialDialog md = builder .customView(R.layout.dialog_preference_colorpicker, true) .build(); int color = (int) mOption.read(mConfig); boolean randomColor = Color.alpha(color) == RANDOM_COLOR_ALPHA_MASK; if (randomColor) color |= Color.argb(255, 0, 0, 0); RadioGroup rg = (RadioGroup) md.getCustomView().findViewById(R.id.radios); mColorPanel = (ViewGroup) rg.findViewById(R.id.custom_color_panel); mColorPicker = (ColorPicker) mColorPanel.findViewById(R.id.picker); mColorPicker.addSaturationBar((SaturationBar) mColorPanel.findViewById(R.id.saturationbar)); mColorPicker.addValueBar((ValueBar) mColorPanel.findViewById(R.id.valuebar)); mColorPicker.setColor(color); mColorPicker.setOldCenterColor(color); // Setup radio things mRadioCustomColor = (RadioButton) rg.findViewById(R.id.custom_color); mRadioRandomColor = (RadioButton) rg.findViewById(R.id.random_color); rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { ViewUtils.setVisible(mColorPanel, mRadioCustomColor.isChecked()); } }); rg.check(randomColor ? mRadioRandomColor.getId() : mRadioCustomColor.getId()); return md; }
Example 10
Source File: DemoActivity.java From MultiRowsRadioGroup with Apache License 2.0 | 5 votes |
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { CompoundButton cb = (CompoundButton) group.findViewById(checkedId); if(cb!=null && cb.isChecked()){ TextView titleTv = ((TextView)group.findViewById(android.R.id.title)); if(titleTv!=null){ titleTv.setText("selected:"+cb.getText()); } } }
Example 11
Source File: TGGraceDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public int findSelectedOption(RadioGroup radioGroup, int defaultValue) { int radioButtonId = radioGroup.getCheckedRadioButtonId(); if( radioButtonId != -1 ) { RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId); if( radioButton != null ) { return ((Integer)radioButton.getTag()).intValue(); } } return defaultValue; }
Example 12
Source File: TGGraceDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public boolean findSelectedOnBeat() { RadioGroup radioGroup = (RadioGroup) this.getView().findViewById(R.id.grace_dlg_position_group); int radioButtonId = radioGroup.getCheckedRadioButtonId(); if( radioButtonId != -1 ) { RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId); if( radioButton != null ) { return ((Boolean)radioButton.getTag()).booleanValue(); } } return false; }
Example 13
Source File: TGMeasureAddDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public int findSelectedMeasureNumber() { RadioGroup optionsGroup = (RadioGroup) this.getView().findViewById(R.id.measure_add_dlg_options_group); int radioButtonId = optionsGroup.getCheckedRadioButtonId(); if( radioButtonId != -1 ) { RadioButton radioButton = (RadioButton) optionsGroup.findViewById(radioButtonId); if( radioButton != null ) { return ((Integer)radioButton.getTag()).intValue(); } } return 1; }
Example 14
Source File: TGMeasurePasteDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public int findSelectedMode() { RadioGroup optionsGroup = (RadioGroup) this.getView().findViewById(R.id.measure_paste_dlg_options_group); int radioButtonId = optionsGroup.getCheckedRadioButtonId(); if( radioButtonId != -1 ) { RadioButton radioButton = (RadioButton) optionsGroup.findViewById(radioButtonId); if( radioButton != null ) { return ((Integer)radioButton.getTag()).intValue(); } } return 1; }
Example 15
Source File: TGStrokeDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public int findSelectedDuration() { RadioGroup radioGroup = (RadioGroup) this.getView().findViewById(R.id.stroke_dlg_duration_group); int radioButtonId = radioGroup.getCheckedRadioButtonId(); if( radioButtonId != -1 ) { RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId); if( radioButton != null ) { return ((Integer)radioButton.getTag()).intValue(); } } return 0; }
Example 16
Source File: SearchDialogFragment.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 5 votes |
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); }
Example 17
Source File: ProfileSearchDialogFragment.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 4 votes |
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); }
Example 18
Source File: PaymentRequestFragment.java From bitcoinpos with MIT License | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mCryptocurrencyAddress = getArguments().getString(ARG_CRYPTOCURRENCY_ADDRESS); mMerchantName = getArguments().getString(ARG_MERCHANT_NAME); mPrimaryAmount = getArguments().getString(ARG_PRIMARY_AMOUNT); mSecondaryAmount = getArguments().getString(ARG_SECONDARY_AMOUNT); mCryptocurrencyIsPrimary = getArguments().getBoolean(ARG_CRYPTOCURRENCY_IS_PRIMARY); mLocalCurrency = getArguments().getString(ARG_LOCAL_CURRENCY); mExchangeRate = getArguments().getString(ARG_EXCHANGE_RATE); mItemsNames = getArguments().getString(ARG_ITEMS_NAMES); mCryptocurrency = getArguments().getString(ARG_CRYPTOCURRENCY); mDbHelper = PointOfSaleDb.getInstance(getActivity()); //Find screen size WindowManager manager = (WindowManager) getActivity().getSystemService(getContext().WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); Point point = new Point(); display.getSize(point); int width = point.x; int height = point.y; int smallerDimension = width < height ? width : height; smallerDimension = smallerDimension * 3/4; String uriCrypto; if(mCryptocurrency.equals(getString(R.string.btc))) { uriCrypto = getString(R.string.bitcoin); } else if(mCryptocurrency.equals(getString(R.string.bch))) { uriCrypto = getString(R.string.bitcoin_cash); } else if(mCryptocurrency.equals(getString(R.string.ltc))) { uriCrypto = getString(R.string.litecoin); } else { uriCrypto = getString(R.string.bitcoin_testnet); } // generate QR code to show in image view try { // generate BIP 21 compatible payment URI String bip21Payment = uriCrypto + ":" + mCryptocurrencyAddress + "?amount=" + (mCryptocurrencyIsPrimary ? mPrimaryAmount : mSecondaryAmount) + "&label=" + URLEncoder.encode(mMerchantName, "UTF-8"); mQrCodeBitmap = encodeAsBitmap(bip21Payment, smallerDimension); //(mBitcoinAddress); } catch (WriterException we) { we.printStackTrace(); } catch (UnsupportedEncodingException uee) { uee.printStackTrace(); } //set the correct value to btc and local currency for the transaction Double setPrimary, setSecondary; if(mCryptocurrencyIsPrimary){ setPrimary = Double.parseDouble(mPrimaryAmount); setSecondary = Double.parseDouble(mSecondaryAmount); } else { setPrimary = Double.parseDouble(mSecondaryAmount); setSecondary = Double.parseDouble(mPrimaryAmount); } //get system time and convert to UNIX Epoch to get the created time of the transaction int systemTimeNow = (int) (System.currentTimeMillis()/1000); radiogroup = (RadioGroup) getActivity().findViewById(R.id.radiogroup); View radioButton = radiogroup.findViewById(radiogroup.getCheckedRadioButtonId()); selected = radiogroup.indexOfChild(radioButton); String cryptocurrency=""; if(selected==0) { cryptocurrency = String.valueOf(CurrencyUtils.CurrencyType.BTC); } else if(selected==1) { cryptocurrency = String.valueOf(CurrencyUtils.CurrencyType.BCH); } else if(selected==2) { cryptocurrency = String.valueOf(CurrencyUtils.CurrencyType.LTC); } else if(selected==3) { cryptocurrency = getString(R.string.btctest); } //Toast.makeText(getActivity(), String.valueOf(selected), Toast.LENGTH_SHORT).show(); final int rowID = UpdateDbHelper.addTransaction(mPaymentTransaction, setPrimary, setSecondary, mLocalCurrency, String.valueOf(systemTimeNow), null, mMerchantName, mCryptocurrencyAddress, TxStatus.PENDING, // payment is requested and the transaction is set to pending mItemsNames, mExchangeRate, cryptocurrency); _rowID = rowID; //send broadcast to update History View BlockchainInfoHelper.sendBroadcast(); } }
Example 19
Source File: FABActivity.java From fab with Apache License 2.0 | 4 votes |
RadioButton getCheckedRadioButton(RadioGroup group) { return (RadioButton) group.findViewById(group.getCheckedRadioButtonId()); }
Example 20
Source File: UrlConfigActivity.java From freeiot-android with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_url_config); mUrlRadioGroup = (RadioGroup) findViewById(R.id.radio_group); mDevRadioBtn = (RadioButton) mUrlRadioGroup.findViewById(R.id.dev_radio); mPreProductRadioBtn = (RadioButton) mUrlRadioGroup.findViewById(R.id.pre_product_radio); mReleaseRadioBtn = (RadioButton) mUrlRadioGroup.findViewById(R.id.release_radio); findViewById(R.id.back).setOnClickListener(this); if (UrlConfigManager.getCurrentState() == UrlConfigManager.DEVELOP_STATE) { mDevRadioBtn.setChecked(true); } else if (UrlConfigManager.getCurrentState() == UrlConfigManager.PREPRODUCT_STATE) { mPreProductRadioBtn.setChecked(true); } else if (UrlConfigManager.getCurrentState() == UrlConfigManager.RELEASE_STATE) { mReleaseRadioBtn.setChecked(true); } mApiHostUrlView = (TextView)findViewById(R.id.tv_apihost_url); setData(); mUrlRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.dev_radio: UrlConfigManager.setCurrentState(UrlConfigManager.DEVELOP_STATE); break; case R.id.pre_product_radio: UrlConfigManager.setCurrentState(UrlConfigManager.PREPRODUCT_STATE); break; case R.id.release_radio: UrlConfigManager.setCurrentState(UrlConfigManager.RELEASE_STATE); break; default: break; } UrlConfigManager.updateUrl(UrlConfigManager.getCurrentState()); AppConfigPrefs.getInstances(UrlConfigActivity.this).saveIntValue("cur_env", UrlConfigManager.getCurrentState()); setData(); } }); }