Java Code Examples for android.widget.RadioButton#getText()

The following examples show how to use android.widget.RadioButton#getText() . 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: RecyclerOnClickListener.java    From IdeaTrackerPlus with MIT License 6 votes vote down vote up
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);
        }
    }
 
Example 2
Source File: RadioGroup.java    From android_maplibui with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object getValue()
{
    RadioButton radioButton = findViewById(getCheckedRadioButtonId());
    String value_alias = (String) radioButton.getText();
    return mAliasValueMap.get(value_alias);
}
 
Example 3
Source File: MainActivity.java    From IdeaTrackerPlus with MIT License 4 votes vote down vote up
private void sendIdeaFromDialog() {
    Switch doLater = (Switch) mNewIdeaDialog.findViewById(R.id.doLater);

    String text = mIdeaField.getText().toString();
    if (!text.equals("")) {

        boolean later = doLater.isChecked();

        if (mRadioGroup.getCheckedRadioButtonId() != -1) {
            View radioButton = mRadioGroup.findViewById(mRadioGroup.getCheckedRadioButtonId());
            RadioButton btn = (RadioButton) mRadioGroup.getChildAt(mRadioGroup.indexOfChild(radioButton));
            String selection = (String) btn.getText();

            String note = mNoteField.getText().toString();
            int priority = Integer.parseInt(selection);

            mDbHelper.newEntry(text, note, priority, later); //add the idea to the actual database
            displayIdeasCount();

            DatabaseHelper.notifyAllLists();
            mDbHelper.sortByAscPriority();

        }

        mNewIdeaDialog.dismiss();

        if (mTinyDB.getBoolean(getString(R.string.handle_idea_pref))) {
            //move tab where idea was created
            int index = 0;
            if (later) index = 1;

            tabLayout.setScrollPosition(index, 0f, true);
            mViewPager.setCurrentItem(index);

            //start the handle idea guide
            handleIdeaGuide();
        }

    } else {
        mIdeaError.setVisibility(View.VISIBLE);
    }
}
 
Example 4
Source File: RadioGroupPreference.java    From meiShi with Apache License 2.0 4 votes vote down vote up
private String getSelectedValue() {
    int radioButtonId = radioGroup.getCheckedRadioButtonId();
    RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId);
    return (String) radioButton.getText();
}