android.widget.RadioButton

Here are the examples of the java api class android.widget.RadioButton taken from open source projects.

1. FormSelectorSegmentedControlFieldCell#addButton()

Project: QMBForm
File: FormSelectorSegmentedControlFieldCell.java
private void addButton(SegmentedGroup group, int id, String displayText, boolean checked) {
    RadioButton radioButton = new RadioButton(getContext(), null, R.style.RadioButton);
    radioButton.setLayoutParams(new SegmentedGroup.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
    radioButton.setText(displayText);
    radioButton.setId(id);
    radioButton.setGravity(Gravity.CENTER_HORIZONTAL);
    radioButton.setClickable(true);
    radioButton.setChecked(checked);
    int padding = getResources().getDimensionPixelOffset(R.dimen.cell_padding);
    radioButton.setPadding(padding, padding, padding, padding);
    group.addView(radioButton);
    group.updateBackground();
}

2. BookCatalogueClassic#sortOptions()

Project: Book-Catalogue
File: BookCatalogueClassic.java
/**
	 * Setup the sort options. This function will also call fillData when 
	 * complete having loaded the appropriate view. 
	 */
private void sortOptions() {
    ScrollView sv = new ScrollView(this);
    RadioGroup group = new RadioGroup(this);
    sv.addView(group);
    final AlertDialog sortDialog = new AlertDialog.Builder(this).setView(sv).create();
    sortDialog.setTitle(R.string.menu_sort_by);
    sortDialog.setIcon(android.R.drawable.ic_menu_info_details);
    sortDialog.show();
    RadioButton radio_author = new RadioButton(this);
    radio_author.setText(R.string.sortby_author);
    group.addView(radio_author);
    if (sort == SORT_AUTHOR) {
        radio_author.setChecked(true);
    } else {
        radio_author.setChecked(false);
    }
    radio_author.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_AUTHOR);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_author_one = new RadioButton(this);
    radio_author_one.setText(R.string.sortby_author_one);
    group.addView(radio_author_one);
    if (sort == SORT_AUTHOR_ONE) {
        radio_author_one.setChecked(true);
    } else {
        radio_author_one.setChecked(false);
    }
    radio_author_one.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_AUTHOR_ONE);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_author_given = new RadioButton(this);
    radio_author_given.setText(R.string.sortby_author_given);
    group.addView(radio_author_given);
    if (sort == SORT_AUTHOR_GIVEN) {
        radio_author_given.setChecked(true);
    } else {
        radio_author_given.setChecked(false);
    }
    radio_author_given.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_AUTHOR_GIVEN);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_title = new RadioButton(this);
    radio_title.setText(R.string.sortby_title);
    group.addView(radio_title);
    if (sort == SORT_TITLE) {
        radio_title.setChecked(true);
    } else {
        radio_title.setChecked(false);
    }
    radio_title.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_TITLE);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_series = new RadioButton(this);
    radio_series.setText(R.string.sortby_series);
    group.addView(radio_series);
    if (sort == SORT_SERIES) {
        radio_series.setChecked(true);
    } else {
        radio_series.setChecked(false);
    }
    radio_series.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_SERIES);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_genre = new RadioButton(this);
    radio_genre.setText(R.string.sortby_genre);
    group.addView(radio_genre);
    if (sort == SORT_GENRE) {
        radio_genre.setChecked(true);
    } else {
        radio_genre.setChecked(false);
    }
    radio_genre.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_GENRE);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_loan = new RadioButton(this);
    radio_loan.setText(R.string.sortby_loan);
    group.addView(radio_loan);
    if (sort == SORT_LOAN) {
        radio_loan.setChecked(true);
    } else {
        radio_loan.setChecked(false);
    }
    radio_loan.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_LOAN);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_unread = new RadioButton(this);
    radio_unread.setText(R.string.sortby_unread);
    group.addView(radio_unread);
    if (sort == SORT_UNREAD) {
        radio_unread.setChecked(true);
    } else {
        radio_unread.setChecked(false);
    }
    radio_unread.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_UNREAD);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_published = new RadioButton(this);
    radio_published.setText(R.string.sortby_published);
    group.addView(radio_published);
    if (sort == SORT_PUBLISHED) {
        radio_published.setChecked(true);
    } else {
        radio_published.setChecked(false);
    }
    radio_published.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_PUBLISHED);
            sortDialog.dismiss();
            return;
        }
    });
}

3. RadioButtonTest#shouldInformRadioGroupThatItIsChecked()

Project: robolectric
File: RadioButtonTest.java
@Test
public void shouldInformRadioGroupThatItIsChecked() throws Exception {
    RadioButton radioButton1 = new RadioButton(null);
    radioButton1.setId(99);
    RadioButton radioButton2 = new RadioButton(null);
    radioButton2.setId(100);
    RadioGroup radioGroup = new RadioGroup(null);
    radioGroup.addView(radioButton1);
    radioGroup.addView(radioButton2);
    radioButton1.setChecked(true);
    assertThat(radioGroup.getCheckedRadioButtonId(), equalTo(radioButton1.getId()));
    radioButton2.setChecked(true);
    assertThat(radioGroup.getCheckedRadioButtonId(), equalTo(radioButton2.getId()));
}

4. RecordFBOActivity#updateControls()

Project: grafika
File: RecordFBOActivity.java
/**
     * Updates the on-screen controls to reflect the current state of the app.
     */
private void updateControls() {
    Button toggleRelease = (Button) findViewById(R.id.fboRecord_button);
    int id = mRecordingEnabled ? R.string.toggleRecordingOff : R.string.toggleRecordingOn;
    toggleRelease.setText(id);
    RadioButton rb;
    rb = (RadioButton) findViewById(R.id.recDrawTwice_radio);
    rb.setChecked(mSelectedRecordMethod == RECMETHOD_DRAW_TWICE);
    rb = (RadioButton) findViewById(R.id.recFbo_radio);
    rb.setChecked(mSelectedRecordMethod == RECMETHOD_FBO);
    rb = (RadioButton) findViewById(R.id.recFramebuffer_radio);
    rb.setChecked(mSelectedRecordMethod == RECMETHOD_BLIT_FRAMEBUFFER);
    rb.setEnabled(mBlitFramebufferAllowed);
    TextView tv = (TextView) findViewById(R.id.nowRecording_text);
    if (mRecordingEnabled) {
        tv.setText(getString(R.string.nowRecording));
    } else {
        tv.setText("");
    }
}

5. BooksOnBookshelf#makeRadio()

Project: Book-Catalogue
File: BooksOnBookshelf.java
/**
	 * Add a radio box to the sort options dialogue.
	 * 
	 * @param sortDialog
	 * @param group
	 * @param style
	 */
private void makeRadio(final AlertDialog sortDialog, final LayoutInflater inf, RadioGroup group, final BooklistStyle style) {
    View v = inf.inflate(R.layout.booklist_style_menu_radio, null);
    RadioButton btn = (RadioButton) v;
    btn.setText(style.getDisplayName());
    if (mCurrentStyle.getCanonicalName().equalsIgnoreCase(style.getCanonicalName())) {
        btn.setChecked(true);
    } else {
        btn.setChecked(false);
    }
    group.addView(btn);
    btn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            handleSelectedStyle(style.getCanonicalName());
            sortDialog.dismiss();
            return;
        }
    });
}

6. BrowsePostsActivity#browse()

Project: BotLibre
File: BrowsePostsActivity.java
public void browse(View view) {
    BrowseConfig config = new BrowseConfig();
    config.typeFilter = "Public";
    RadioButton radio = (RadioButton) findViewById(R.id.personalRadio);
    if (radio.isChecked()) {
        config.typeFilter = "Personal";
    }
    Spinner sortSpin = (Spinner) findViewById(R.id.sortSpin);
    config.sort = (String) sortSpin.getSelectedItem();
    AutoCompleteTextView tagText = (AutoCompleteTextView) findViewById(R.id.tagsText);
    config.tag = (String) tagText.getText().toString();
    EditText filterEdit = (EditText) findViewById(R.id.filterText);
    config.filter = filterEdit.getText().toString();
    CheckBox checkbox = (CheckBox) findViewById(R.id.imagesCheckBox);
    MainActivity.showImages = checkbox.isChecked();
    config.type = getType();
    if (MainActivity.instance != null) {
        config.instance = MainActivity.instance.id;
    }
    HttpAction action = new HttpGetPostsAction(this, config);
    action.execute();
}

7. MainActivity#setupRadioGroup()

Project: TinyDancer
File: MainActivity.java
private void setupRadioGroup() {
    radioGroup.check(R.id.defaultValue);
    // set initial value
    RadioButton button = ButterKnife.findById(radioGroup, R.id.defaultValue);
    recyclerView.setMegaBytes(Float.valueOf(button.getText().toString()));
    radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup radioGroup, int i) {
            RadioButton button = ButterKnife.findById(radioGroup, i);
            recyclerView.setMegaBytes(Float.valueOf(button.getText().toString()));
            recyclerView.notifyDataSetChanged();
        }
    });
}

8. ViewOnlineEvent#addTypesField()

Project: eeVee-Final-Presentation
File: ViewOnlineEvent.java
public void addTypesField() {
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    RadioButton[] typeRB = new RadioButton[typeSize];
    int i;
    for (i = 0; i < typeSize; i++) {
        typeRB[i] = new RadioButton(this);
        typeRB[i].setText(Constants.FILTERS.typeFilters[i]);
        typeRB[i].setId(i + 1);
        typeEventRG.addView(typeRB[i], p);
    }
}

9. TaskInput#addTypesField()

Project: eeVee-Final-Presentation
File: TaskInput.java
public void addTypesField() {
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    RadioButton[] typeRB = new RadioButton[typeSize];
    int i;
    for (i = 0; i < typeSize; i++) {
        typeRB[i] = new RadioButton(this);
        typeRB[i].setText(Constants.FILTERS.typeFilters[i]);
        typeRB[i].setId(i + 1);
        typeTaskRG.addView(typeRB[i], p);
    }
}

10. EventInput#addTypesField()

Project: eeVee-Final-Presentation
File: EventInput.java
public void addTypesField() {
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    RadioButton[] typeRB = new RadioButton[typeSize];
    int i;
    for (i = 0; i < typeSize; i++) {
        typeRB[i] = new RadioButton(this);
        typeRB[i].setText(Constants.FILTERS.typeFilters[i]);
        typeRB[i].setId(i + 1);
        typeEventRG.addView(typeRB[i], p);
    }
}

11. EditAndViewTask#addTypesField()

Project: eeVee-Final-Presentation
File: EditAndViewTask.java
public void addTypesField() {
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    RadioButton[] typeRB = new RadioButton[typeSize];
    int i;
    for (i = 0; i < typeSize; i++) {
        typeRB[i] = new RadioButton(this);
        typeRB[i].setText(Constants.FILTERS.typeFilters[i]);
        typeRB[i].setId(i + 1);
        typeTaskRG.addView(typeRB[i], p);
    }
}

12. EditAndViewEvent#addTypesField()

Project: eeVee-Final-Presentation
File: EditAndViewEvent.java
public void addTypesField() {
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    RadioButton[] typeRB = new RadioButton[typeSize];
    int i;
    for (i = 0; i < typeSize; i++) {
        typeRB[i] = new RadioButton(this);
        typeRB[i].setText(Constants.FILTERS.typeFilters[i]);
        typeRB[i].setId(i + 1);
        typeEventRG.addView(typeRB[i], p);
    }
}

13. AccessControl2Activity#viewAPICredentials()

Project: diva-android
File: AccessControl2Activity.java
public void viewAPICredentials(View view) {
    //RadioButton rbalreadyreg = (RadioButton) findViewById(R.id.aci2rbalreadyreg);
    RadioButton rbregnow = (RadioButton) findViewById(R.id.aci2rbregnow);
    Intent i = new Intent();
    boolean chk_pin = rbregnow.isChecked();
    // Calling implicit intent i.e. with app defined action instead of activity class
    i.setAction("jakhar.aseem.diva.action.VIEW_CREDS2");
    i.putExtra(getString(R.string.chk_pin), chk_pin);
    // Check whether the intent resolves to an activity or not
    if (i.resolveActivity(getPackageManager()) != null) {
        startActivity(i);
    } else {
        Toast.makeText(this, "Error while getting Tveeter API details", Toast.LENGTH_SHORT).show();
        Log.e("Diva-aci1", "Couldn't resolve the Intent VIEW_CREDS2 to our activity");
    }
}

14. LocaleEdit#onCreate()

Project: afwall
File: LocaleEdit.java
protected void onCreate(Bundle paramBundle) {
    super.onCreate(paramBundle);
    BundleScrubber.scrub(getIntent());
    BundleScrubber.scrub(getIntent().getBundleExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE));
    setContentView(R.layout.tasker_profile);
    Toolbar toolbar = (Toolbar) findViewById(R.id.tasker_toolbar);
    setSupportActionBar(toolbar);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    //final int currentPosition = prefs.getInt("storedPosition", 0);
    RadioButton tasker_enable = (RadioButton) findViewById(R.id.tasker_enable);
    RadioButton tasker_disable = (RadioButton) findViewById(R.id.tasker_disable);
    RadioButton button1 = (RadioButton) findViewById(R.id.defaultProfile);
    RadioButton button2 = (RadioButton) findViewById(R.id.profile1);
    RadioButton button3 = (RadioButton) findViewById(R.id.profile2);
    RadioButton button4 = (RadioButton) findViewById(R.id.profile3);
    RadioGroup profiles = (RadioGroup) findViewById(R.id.radioProfiles);
    List<String> profilesList = G.getAdditionalProfiles();
    //int textColor = Color.parseColor("#000000");
    int counter = CUSTOM_PROFILE_ID;
    for (String profile : profilesList) {
        RadioButton rdbtn = new RadioButton(this);
        rdbtn.setId(counter++);
        rdbtn.setText(profile);
        profiles.addView(rdbtn);
    }
    String name = prefs.getString("default", getString(R.string.defaultProfile));
    button1.setText(name != null && name.length() == 0 ? getString(R.string.defaultProfile) : name);
    name = prefs.getString("profile1", getString(R.string.profile1));
    button2.setText(name != null && name.length() == 0 ? getString(R.string.profile1) : name);
    name = prefs.getString("profile2", getString(R.string.profile2));
    button3.setText(name != null && name.length() == 0 ? getString(R.string.profile2) : name);
    name = prefs.getString("profile3", getString(R.string.profile3));
    button4.setText(name != null && name.length() == 0 ? getString(R.string.profile3) : name);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        setupTitleApi11();
    } else {
    }
    if (null == paramBundle) {
        final Bundle forwardedBundle = getIntent().getBundleExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE);
        if (PluginBundleManager.isBundleValid(forwardedBundle)) {
            String index = forwardedBundle.getString(PluginBundleManager.BUNDLE_EXTRA_STRING_MESSAGE);
            if (index.contains("::")) {
                index = index.split("::")[0];
            }
            String enable = getString(R.string.enable);
            if (index != null) {
                //int id = Integer.parseInt(index);
                switch(index) {
                    case "0":
                        tasker_enable.setChecked(true);
                        break;
                    case "1":
                        tasker_disable.setChecked(true);
                        break;
                    case "2":
                        button1.setChecked(true);
                        break;
                    case "3":
                        button2.setChecked(true);
                        break;
                    case "4":
                        button3.setChecked(true);
                        break;
                    case "5":
                        button4.setChecked(true);
                        break;
                    default:
                        int diff = CUSTOM_PROFILE_ID + (Integer.parseInt(index) - 6);
                        RadioButton btn = (RadioButton) findViewById(diff);
                        if (btn != null) {
                            btn.setChecked(true);
                        }
                }
            /*if(id > 5) {
						int diff = CUSTOM_PROFILE_ID + (id - 6);
						RadioButton btn = (RadioButton) findViewById(diff);
						if(btn !=null) {
							btn.setChecked(true);	
						}
					}*/
            }
        }
    }
}

15. RadioGroupActivity#onCreate()

Project: coursera-android
File: RadioGroupActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    final TextView tv = (TextView) findViewById(R.id.textView);
    // Define a generic listener for all three RadioButtons in the RadioGroup
    final OnClickListener radioListener = new OnClickListener() {

        @Override
        public void onClick(View v) {
            RadioButton rb = (RadioButton) v;
            tv.setText(rb.getText() + " chosen");
        }
    };
    final RadioButton choice1 = (RadioButton) findViewById(R.id.choice1);
    // Called when RadioButton choice1 is clicked
    choice1.setOnClickListener(radioListener);
    final RadioButton choice2 = (RadioButton) findViewById(R.id.choice2);
    // Called when RadioButton choice2 is clicked
    choice2.setOnClickListener(radioListener);
    final RadioButton choice3 = (RadioButton) findViewById(R.id.choice3);
    // Called when RadioButton choice3 is clicked
    choice3.setOnClickListener(radioListener);
}

16. SettingFragment#showIconDialog()

Project: SeeWeather
File: SettingFragment.java
private void showIconDialog() {
    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View dialogLayout = inflater.inflate(R.layout.icon_dialog, (ViewGroup) getActivity().findViewById(R.id.dialog_root));
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setView(dialogLayout);
    final AlertDialog alertDialog = builder.create();
    LinearLayout layoutTypeOne = (LinearLayout) dialogLayout.findViewById(R.id.layout_one);
    layoutTypeOne.setClickable(true);
    RadioButton radioTypeOne = (RadioButton) dialogLayout.findViewById(R.id.radio_one);
    LinearLayout layoutTypeTwo = (LinearLayout) dialogLayout.findViewById(R.id.layout_two);
    layoutTypeTwo.setClickable(true);
    RadioButton radioTypeTwo = (RadioButton) dialogLayout.findViewById(R.id.radio_two);
    TextView done = (TextView) dialogLayout.findViewById(R.id.done);
    radioTypeOne.setClickable(false);
    radioTypeTwo.setClickable(false);
    alertDialog.show();
    switch(mSetting.getIconType()) {
        case 0:
            radioTypeOne.setChecked(true);
            radioTypeTwo.setChecked(false);
            break;
        case 1:
            radioTypeOne.setChecked(false);
            radioTypeTwo.setChecked(true);
            break;
    }
    layoutTypeOne.setOnClickListener( v -> {
        radioTypeOne.setChecked(true);
        radioTypeTwo.setChecked(false);
    });
    layoutTypeTwo.setOnClickListener( v -> {
        radioTypeOne.setChecked(false);
        radioTypeTwo.setChecked(true);
    });
    done.setOnClickListener( v -> {
        mSetting.setIconType(radioTypeOne.isChecked() ? 0 : 1);
        String[] iconsText = getResources().getStringArray(R.array.icons);
        mChangeIcons.setSummary(radioTypeOne.isChecked() ? iconsText[0] : iconsText[1]);
        alertDialog.dismiss();
        Snackbar.make(getView(), "????,??????", Snackbar.LENGTH_INDEFINITE).setAction("??",  v1 -> {
            Intent intent = getActivity().getPackageManager().getLaunchIntentForPackage(getActivity().getPackageName());
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            getActivity().startActivity(intent);
        }).show();
    });
}

17. RxRadioGroupTest#setUp()

Project: RxBinding
File: RxRadioGroupTest.java
@Before
public void setUp() {
    RadioButton button1 = new RadioButton(context);
    button1.setId(1);
    view.addView(button1);
    RadioButton button2 = new RadioButton(context);
    button2.setId(2);
    view.addView(button2);
}

18. BrowsePeerFragment#initRadioButton()

Project: frostwire-android
File: BrowsePeerFragment.java
private RadioButton initRadioButton(View v, int viewId, final byte fileType) {
    final RadioButton button = findView(v, viewId);
    final Resources r = button.getResources();
    final FileTypeRadioButtonSelectorFactory fileTypeRadioButtonSelectorFactory = new FileTypeRadioButtonSelectorFactory(fileType, r, FileTypeRadioButtonSelectorFactory.RadioButtonContainerType.BROWSE);
    fileTypeRadioButtonSelectorFactory.updateButtonBackground(button);
    button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (button.isChecked()) {
                browseFilesButtonClick(fileType);
            }
            fileTypeRadioButtonSelectorFactory.updateButtonBackground(button);
        }
    });
    button.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                browseFilesButtonClick(fileType);
            }
            fileTypeRadioButtonSelectorFactory.updateButtonBackground(button);
        }
    });
    button.setChecked(fileType == Constants.FILE_TYPE_AUDIO);
    return button;
}

19. SamplerActivity#onCreate()

Project: coursera-android
File: SamplerActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    // 
    final ImageButton button = (ImageButton) findViewById(R.id.button);
    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // Show Toast message 
            Toast.makeText(SamplerActivity.this, "Beep Bop", Toast.LENGTH_SHORT).show();
        }
    });
    final EditText edittext = (EditText) findViewById(R.id.edittext);
    edittext.setOnKeyListener(new OnKeyListener() {

        public boolean onKey(View v, int keyCode, KeyEvent event) {
            // If the event is a key-down event on the "Done" button
            if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                // Show Toast message 
                Toast.makeText(SamplerActivity.this, edittext.getText(), Toast.LENGTH_SHORT).show();
                return true;
            }
            return false;
        }
    });
    final CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox);
    checkbox.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // Show Toast message indicating the CheckBox's Checked state
            if (((CheckBox) v).isChecked()) {
                Toast.makeText(SamplerActivity.this, "CheckBox checked", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(SamplerActivity.this, "CheckBox not checked", Toast.LENGTH_SHORT).show();
            }
        }
    });
    final RadioButton radio_red = (RadioButton) findViewById(R.id.radio_red);
    final RadioButton radio_blue = (RadioButton) findViewById(R.id.radio_blue);
    radio_red.setOnClickListener(radio_listener);
    radio_blue.setOnClickListener(radio_listener);
    final ToggleButton togglebutton = (ToggleButton) findViewById(R.id.togglebutton);
    togglebutton.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // Perform action on clicks
            if (togglebutton.isChecked()) {
                Toast.makeText(SamplerActivity.this, "ToggleButton checked", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(SamplerActivity.this, "ToggleButton not checked", Toast.LENGTH_SHORT).show();
            }
        }
    });
    final RatingBar ratingbar = (RatingBar) findViewById(R.id.ratingbar);
    ratingbar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {

        public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
            Toast.makeText(SamplerActivity.this, "New Rating: " + rating, Toast.LENGTH_SHORT).show();
        }
    });
}

20. RadioButtonTest#canBeClickedToToggleCheckedState()

Project: robolectric
File: RadioButtonTest.java
@Test
public void canBeClickedToToggleCheckedState() throws Exception {
    RadioButton radioButton = new RadioButton(null);
    assertFalse(radioButton.isChecked());
    radioButton.performClick();
    assertTrue(radioButton.isChecked());
    radioButton.performClick();
    assertFalse(radioButton.isChecked());
}

21. RadioButtonTest#canBeToggledBetweenCheckedState()

Project: robolectric
File: RadioButtonTest.java
@Test
public void canBeToggledBetweenCheckedState() throws Exception {
    RadioButton radioButton = new RadioButton(null);
    assertFalse(radioButton.isChecked());
    radioButton.toggle();
    assertTrue(radioButton.isChecked());
    radioButton.toggle();
    assertFalse(radioButton.isChecked());
}

22. RadioButtonTest#canBeExplicitlyChecked()

Project: robolectric
File: RadioButtonTest.java
@Test
public void canBeExplicitlyChecked() throws Exception {
    RadioButton radioButton = new RadioButton(null);
    assertFalse(radioButton.isChecked());
    radioButton.setChecked(true);
    assertTrue(radioButton.isChecked());
    radioButton.setChecked(false);
    assertFalse(radioButton.isChecked());
}

23. SettingsActivity#mapProviderDialog()

Project: LeafPic
File: SettingsActivity.java
private void mapProviderDialog() {
    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
    View dialogLayout = getLayoutInflater().inflate(R.layout.dialog_map_provider, null);
    TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.title);
    ((CardView) dialogLayout.findViewById(R.id.rename_card)).setCardBackgroundColor(getCardBackgroundColor());
    dialogTitle.setBackgroundColor(getPrimaryColor());
    final RadioGroup mapProvider = (RadioGroup) dialogLayout.findViewById(R.id.radio_group_maps_provider);
    RadioButton radioGoogleMaps = (RadioButton) dialogLayout.findViewById(R.id.radio_google_maps);
    RadioButton radioOsmDe = (RadioButton) dialogLayout.findViewById(R.id.radio_osm_de);
    RadioButton radioTyler = (RadioButton) dialogLayout.findViewById(R.id.radio_osm_tyler);
    setRadioTextButtonColor(radioGoogleMaps, getSubTextColor());
    setRadioTextButtonColor(radioOsmDe, getSubTextColor());
    setRadioTextButtonColor(radioTyler, getSubTextColor());
    ((TextView) dialogLayout.findViewById(R.id.header_proprietary_maps)).setTextColor(getTextColor());
    ((TextView) dialogLayout.findViewById(R.id.header_free_maps)).setTextColor(getTextColor());
    switch(SP.getInt(getString(R.string.preference_map_provider), GOOGLE_MAPS_PROVIDER)) {
        case GOOGLE_MAPS_PROVIDER:
        default:
            radioGoogleMaps.setChecked(true);
            break;
        case OSM_DE_PROVIDER:
            radioOsmDe.setChecked(true);
            break;
        case OSM_TYLER_PROVIDER:
            radioTyler.setChecked(true);
            break;
    }
    dialogBuilder.setNegativeButton(R.string.cancel, null);
    dialogBuilder.setPositiveButton(R.string.ok_action, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            SharedPreferences.Editor editor = SP.edit();
            editor.putInt(getString(R.string.preference_map_provider), baseThemeValue);
            editor.apply();
            switch(mapProvider.getCheckedRadioButtonId()) {
                case R.id.radio_google_maps:
                default:
                    editor.putInt(getString(R.string.preference_map_provider), GOOGLE_MAPS_PROVIDER);
                    break;
                case R.id.radio_osm_de:
                    editor.putInt(getString(R.string.preference_map_provider), OSM_DE_PROVIDER);
                    break;
                case R.id.radio_osm_tyler:
                    editor.putInt(getString(R.string.preference_map_provider), OSM_TYLER_PROVIDER);
                    break;
            }
            editor.apply();
        }
    });
    dialogBuilder.setView(dialogLayout);
    dialogBuilder.show();
}

24. LyricFragment#getCircles()

Project: KJMusic
File: LyricFragment.java
/**
     * ????"??"
     */
private RadioButton getCircles() {
    RadioButton circle = new RadioButton(getActivity());
    int dimen5 = (int) getResources().getDimension(R.dimen.space_5);
    int dimen3 = (int) getResources().getDimension(R.dimen.space_3);
    RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(dimen5, dimen5);
    params.setMargins(dimen3, 0, dimen3, 0);
    circle.setLayoutParams(params);
    circle.setBackgroundResource(R.drawable.selector_rbtn_circle);
    return circle;
}

25. EqualizerActivity#setupEqualizerFxAndUI()

Project: jamendo-android
File: EqualizerActivity.java
/**
     * Create the equalizer view
     */
private void setupEqualizerFxAndUI() {
    // Since there is no guarantee that app equalizer may be usable
    // a global equalizer may be used only to access presets
    final Equalizer equalizer = new Equalizer(0, 0);
    Log.i(JamendoApplication.TAG, "setupEqualizerFxAndUI " + equalizer.getNumberOfPresets());
    Settings settings = JamendoApplication.getInstance().getEqualizerSettigns();
    // Association between radio button and prest equalization 
    final SparseArray<Short> group = new SparseArray<Short>();
    for (int i = equalizer.getNumberOfPresets() - 1; i >= 0; i--) {
        RadioButton button = new RadioButton(this);
        button.setText(equalizer.getPresetName((short) i));
        mRadioGroup.addView(button);
        group.put(button.getId(), (short) i);
        if (settings != null && settings.curPreset == i) {
            button.setChecked(true);
        }
    }
    // radio button that custom the equalization
    RadioButton custom = new RadioButton(this);
    custom.setText(R.string.custom);
    mRadioGroup.addView(custom);
    if (settings == null || settings.curPreset == -1) {
        mRadioGroup.check(custom.getId());
    }
    equalizer.release();
    // Activity for custom button, will always show the dialog
    custom.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            new CustomEqualizer(mActivity).show();
        }
    });
    // Event for radio button
    this.mRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
            Short preset = group.get(checkedId);
            if (preset != null) {
                mRadioGroup.check(checkedId);
                if (JamendoApplication.getInstance().isEqualizerRunning()) {
                    final Equalizer eq = JamendoApplication.getInstance().getMyEqualizer();
                    eq.usePreset(preset);
                    JamendoApplication.getInstance().updateEqualizerSettings(eq.getProperties());
                } else {
                    // save for later use
                    JamendoApplication.getInstance().setEqualizerPreset(preset);
                }
            }
        }
    });
}

26. HardwareScalerActivity#configureRadioButton()

Project: grafika
File: HardwareScalerActivity.java
/**
     * Generates the radio button text.
     */
private void configureRadioButton(int id, int index) {
    RadioButton rb;
    rb = (RadioButton) findViewById(id);
    rb.setChecked(mSelectedSize == index);
    rb.setText(SURFACE_LABEL[index] + " (" + mWindowWidthHeight[index][0] + "x" + mWindowWidthHeight[index][1] + ")");
}

27. ViewMatchersTest#testCheckBoxMatchers()

Project: double-espresso
File: ViewMatchersTest.java
public void testCheckBoxMatchers() {
    assertFalse(isChecked().matches(new Spinner(getInstrumentation().getTargetContext())));
    assertFalse(isNotChecked().matches(new Spinner(getInstrumentation().getTargetContext())));
    CheckBox checkBox = new CheckBox(getInstrumentation().getTargetContext());
    checkBox.setChecked(true);
    assertTrue(isChecked().matches(checkBox));
    assertFalse(isNotChecked().matches(checkBox));
    checkBox.setChecked(false);
    assertFalse(isChecked().matches(checkBox));
    assertTrue(isNotChecked().matches(checkBox));
    RadioButton radioButton = new RadioButton(getInstrumentation().getTargetContext());
    radioButton.setChecked(false);
    assertFalse(isChecked().matches(radioButton));
    assertTrue(isNotChecked().matches(radioButton));
    radioButton.setChecked(true);
    assertTrue(isChecked().matches(radioButton));
    assertFalse(isNotChecked().matches(radioButton));
    CheckedTextView checkedText = new CheckedTextView(getInstrumentation().getTargetContext());
    checkedText.setChecked(false);
    assertFalse(isChecked().matches(checkedText));
    assertTrue(isNotChecked().matches(checkedText));
    checkedText.setChecked(true);
    assertTrue(isChecked().matches(checkedText));
    assertFalse(isNotChecked().matches(checkedText));
    Checkable checkable = new Checkable() {

        @Override
        public boolean isChecked() {
            return true;
        }

        @Override
        public void setChecked(boolean ignored) {
        }

        @Override
        public void toggle() {
        }
    };
    assertFalse(isChecked().matches(checkable));
    assertFalse(isNotChecked().matches(checkable));
}

28. RadioGroup1#onCreate()

Project: codeexamples-android
File: RadioGroup1.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.radio_group_1);
    mRadioGroup = (RadioGroup) findViewById(R.id.menu);
    // test adding a radio button programmatically
    RadioButton newRadioButton = new RadioButton(this);
    newRadioButton.setText(R.string.radio_group_snack);
    newRadioButton.setId(R.id.snack);
    LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);
    mRadioGroup.addView(newRadioButton, 0, layoutParams);
    // test listening to checked change events
    String selection = getString(R.string.radio_group_selection);
    mRadioGroup.setOnCheckedChangeListener(this);
    mChoice = (TextView) findViewById(R.id.choice);
    mChoice.setText(selection + mRadioGroup.getCheckedRadioButtonId());
    // test clearing the selection
    Button clearButton = (Button) findViewById(R.id.clear);
    clearButton.setOnClickListener(this);
}

29. BrowseActivity#browse()

Project: BotLibre
File: BrowseActivity.java
public void browse(View view) {
    BrowseConfig config = new BrowseConfig();
    config.typeFilter = "Public";
    RadioButton radio = (RadioButton) findViewById(R.id.privateRadio);
    if (radio.isChecked()) {
        config.typeFilter = "Private";
    }
    radio = (RadioButton) findViewById(R.id.personalRadio);
    if (radio.isChecked()) {
        config.typeFilter = "Personal";
    }
    Spinner sortSpin = (Spinner) findViewById(R.id.sortSpin);
    config.sort = (String) sortSpin.getSelectedItem();
    AutoCompleteTextView tagText = (AutoCompleteTextView) findViewById(R.id.tagsText);
    config.tag = (String) tagText.getText().toString();
    AutoCompleteTextView categoryText = (AutoCompleteTextView) findViewById(R.id.categoriesText);
    config.category = (String) categoryText.getText().toString();
    EditText filterEdit = (EditText) findViewById(R.id.filterText);
    config.filter = filterEdit.getText().toString();
    CheckBox checkbox = (CheckBox) findViewById(R.id.imagesCheckBox);
    MainActivity.showImages = checkbox.isChecked();
    config.type = getType();
    HttpAction action = new HttpGetInstancesAction(this, config);
    action.execute();
}

30. BrowseActivity#browse()

Project: BotLibre
File: BrowseActivity.java
public void browse(View view) {
    BrowseConfig config = new BrowseConfig();
    config.typeFilter = "Public";
    RadioButton radio = (RadioButton) findViewById(R.id.privateRadio);
    if (radio.isChecked()) {
        config.typeFilter = "Private";
    }
    radio = (RadioButton) findViewById(R.id.personalRadio);
    if (radio.isChecked()) {
        config.typeFilter = "Personal";
    }
    Spinner sortSpin = (Spinner) findViewById(R.id.sortSpin);
    config.sort = (String) sortSpin.getSelectedItem();
    AutoCompleteTextView tagText = (AutoCompleteTextView) findViewById(R.id.tagsText);
    config.tag = (String) tagText.getText().toString();
    AutoCompleteTextView categoryText = (AutoCompleteTextView) findViewById(R.id.categoriesText);
    config.category = (String) categoryText.getText().toString();
    EditText filterEdit = (EditText) findViewById(R.id.filterText);
    config.filter = filterEdit.getText().toString();
    CheckBox checkbox = (CheckBox) findViewById(R.id.imagesCheckBox);
    MainActivity.showImages = checkbox.isChecked();
    config.type = getType();
    HttpAction action = new HttpGetInstancesAction(this, config);
    action.execute();
}

31. RadioGroup1#onCreate()

Project: android-maven-plugin
File: RadioGroup1.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.radio_group_1);
    mRadioGroup = (RadioGroup) findViewById(R.id.menu);
    // test adding a radio button programmatically
    RadioButton newRadioButton = new RadioButton(this);
    newRadioButton.setText(R.string.radio_group_snack);
    newRadioButton.setId(R.id.snack);
    LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);
    mRadioGroup.addView(newRadioButton, 0, layoutParams);
    // test listening to checked change events
    String selection = getString(R.string.radio_group_selection);
    mRadioGroup.setOnCheckedChangeListener(this);
    mChoice = (TextView) findViewById(R.id.choice);
    mChoice.setText(selection + mRadioGroup.getCheckedRadioButtonId());
    // test clearing the selection
    Button clearButton = (Button) findViewById(R.id.clear);
    clearButton.setOnClickListener(this);
}

32. MainActivity#getSelectedRadio()

Project: ud862-samples
File: MainActivity.java
public RadioButton getSelectedRadio(View view) {
    RadioButton[] btns = { centerBtn, centerCropBtn, centerInsideBtn, fitCenterBtn, fitEndBtn, fitStartBtn, fitXYBtn, matrixBtn, noneBtn };
    for (RadioButton radioButton : btns) {
        if (radioButton.isChecked() && radioButton != view) {
            return radioButton;
        }
    }
    return null;
}

33. RecordFBOActivity#onRadioButtonClicked()

Project: grafika
File: RecordFBOActivity.java
/**
     * onClick handler for radio buttons.
     */
public void onRadioButtonClicked(View view) {
    RadioButton rb = (RadioButton) view;
    if (!rb.isChecked()) {
        Log.d(TAG, "Got click on non-checked radio button");
        return;
    }
    switch(rb.getId()) {
        case R.id.recDrawTwice_radio:
            mSelectedRecordMethod = RECMETHOD_DRAW_TWICE;
            break;
        case R.id.recFbo_radio:
            mSelectedRecordMethod = RECMETHOD_FBO;
            break;
        case R.id.recFramebuffer_radio:
            mSelectedRecordMethod = RECMETHOD_BLIT_FRAMEBUFFER;
            break;
        default:
            throw new RuntimeException("Click from unknown id " + rb.getId());
    }
    Log.d(TAG, "Selected rec mode " + mSelectedRecordMethod);
    RenderHandler rh = mRenderThread.getHandler();
    if (rh != null) {
        rh.setRecordMethod(mSelectedRecordMethod);
    }
}

34. HardwareScalerActivity#onRadioButtonClicked()

Project: grafika
File: HardwareScalerActivity.java
/**
     * onClick handler for radio buttons.
     */
public void onRadioButtonClicked(View view) {
    int newSize;
    RadioButton rb = (RadioButton) view;
    if (!rb.isChecked()) {
        Log.d(TAG, "Got click on non-checked radio button");
        return;
    }
    switch(rb.getId()) {
        case R.id.surfaceSizeTiny_radio:
            newSize = SURFACE_SIZE_TINY;
            break;
        case R.id.surfaceSizeSmall_radio:
            newSize = SURFACE_SIZE_SMALL;
            break;
        case R.id.surfaceSizeMedium_radio:
            newSize = SURFACE_SIZE_MEDIUM;
            break;
        case R.id.surfaceSizeFull_radio:
            newSize = SURFACE_SIZE_FULL;
            break;
        default:
            throw new RuntimeException("Click from unknown id " + rb.getId());
    }
    mSelectedSize = newSize;
    int[] wh = mWindowWidthHeight[newSize];
    // Update the Surface size.  This causes a "surface changed" event, but does not
    // destroy and re-create the Surface.
    SurfaceView sv = (SurfaceView) findViewById(R.id.hardwareScaler_surfaceView);
    SurfaceHolder sh = sv.getHolder();
    Log.d(TAG, "setting size to " + wh[0] + "x" + wh[1]);
    sh.setFixedSize(wh[0], wh[1]);
}

35. MainActivity#showExportCsvDialog()

Project: glucosio-android
File: MainActivity.java
public void showExportCsvDialog() {
    final Dialog exportDialog = new Dialog(MainActivity.this, R.style.GlucosioTheme);
    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.copyFrom(exportDialog.getWindow().getAttributes());
    lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
    lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
    exportDialog.setContentView(R.layout.dialog_export);
    exportDialog.getWindow().setAttributes(lp);
    exportDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    exportDialog.getWindow().setDimAmount(0.5f);
    exportDialog.show();
    exportDialogDateFrom = (TextView) exportDialog.findViewById(R.id.activity_export_date_from);
    exportDialogDateTo = (TextView) exportDialog.findViewById(R.id.activity_export_date_to);
    exportRangeButton = (RadioButton) exportDialog.findViewById(R.id.activity_export_range);
    final RadioButton exportAllButton = (RadioButton) exportDialog.findViewById(R.id.activity_export_all);
    final TextView exportButton = (TextView) exportDialog.findViewById(R.id.dialog_export_add);
    final TextView cancelButton = (TextView) exportDialog.findViewById(R.id.dialog_export_cancel);
    exportRangeButton.setChecked(true);
    exportDialogDateFrom.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Calendar now = Calendar.getInstance();
            DatePickerDialog dpd = DatePickerDialog.newInstance(MainActivity.this, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
            dpd.show(getFragmentManager(), "fromDateDialog");
            dpd.setMaxDate(now);
        }
    });
    exportDialogDateTo.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Calendar now = Calendar.getInstance();
            DatePickerDialog dpd = DatePickerDialog.newInstance(MainActivity.this, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
            dpd.show(getFragmentManager(), "toDateDialog");
            dpd.setMaxDate(now);
        }
    });
    exportRangeButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean isChecked = exportRangeButton.isChecked();
            exportDialogDateFrom.setEnabled(true);
            exportDialogDateTo.setEnabled(true);
            exportAllButton.setChecked(!isChecked);
        }
    });
    exportAllButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean isChecked = exportAllButton.isChecked();
            exportDialogDateFrom.setEnabled(false);
            exportDialogDateTo.setEnabled(false);
            exportRangeButton.setChecked(!isChecked);
            exportButton.setEnabled(true);
        }
    });
    exportButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (validateExportDialog()) {
                exportPresenter.onExportClicked(exportAllButton.isChecked());
                exportDialog.dismiss();
            } else {
                showSnackBar(getResources().getString(R.string.dialog_error), Snackbar.LENGTH_LONG);
            }
        }
    });
    cancelButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            exportDialog.dismiss();
        }
    });
}

36. ViewOnlineEvent#setEventType()

Project: eeVee-Final-Presentation
File: ViewOnlineEvent.java
public void setEventType(String type) {
    int i;
    for (i = 0; i < typeSize; i++) {
        String temp = Constants.FILTERS.typeFilters[i];
        if (temp.matches(type))
            break;
    }
    RadioButton typeToBeCheckedRB = (RadioButton) typeEventRG.findViewById(i + 1);
    typeToBeCheckedRB.setChecked(true);
}

37. ViewOnlineEvent#resetFields()

Project: eeVee-Final-Presentation
File: ViewOnlineEvent.java
public void resetFields() {
    RadioGroup typeEventRGLocal = (RadioGroup) eventViewOnlinePanelLL.findViewById(R.id.typeEventRG);
    RadioButton miscRB = (RadioButton) typeEventRGLocal.findViewById(7);
    selectingTimeDoneEventA = false;
    startDateStoreStringEventA = "";
    endDateStoreStingEventA = "";
    startTimeEvent.InitialiseTimeVariables();
    endTimeEvent.InitialiseTimeVariables();
    startTimeEventA.InitialiseTimeVariables();
    endTimeEventA.InitialiseTimeVariables();
    regnTimeEvent.InitialiseTimeVariables();
    startDateEvent.InitialiseDateVariables();
    endDateEvent.InitialiseDateVariables();
    startDateEventB.InitialiseDateVariables();
    endDateEventB.InitialiseDateVariables();
    regnDateEvent.InitialiseDateVariables();
    durationEvent.initialiseVariables();
    layoutEventThree.setVisibility(View.GONE);
    layoutEventThreeA.setVisibility(View.GONE);
    layoutEventThreeB.setVisibility(View.GONE);
    dayEventCheckboxGrp.setVisibility(View.GONE);
    setETEmpty();
    uncheckWeekDaysCB();
    repetitionEventRG.clearCheck();
    typeEventRG.clearCheck();
    noneEventRB.setChecked(true);
    miscRB.setChecked(true);
}

38. TaskInput#resetFields()

Project: eeVee-Final-Presentation
File: TaskInput.java
public void resetFields() {
    RadioButton miscRB = (RadioButton) typeTaskRG.findViewById(7);
    selectingTimeDoneTaskA = false;
    startDateStoreStringTaskA = "";
    endDateStoreStingTaskA = "";
    startTimeTask.InitialiseTimeVariables();
    endTimeTask.InitialiseTimeVariables();
    startTimeTaskA.InitialiseTimeVariables();
    endTimeTaskA.InitialiseTimeVariables();
    startDateTask.InitialiseDateVariables();
    endDateTask.InitialiseDateVariables();
    startDateTaskB.InitialiseDateVariables();
    endDateTaskB.InitialiseDateVariables();
    durationTask.initialiseVariables();
    layoutTaskOne.setVisibility(View.VISIBLE);
    layoutTaskTwo.setVisibility(View.GONE);
    layoutTaskThree.setVisibility(View.GONE);
    layoutTaskThreeA.setVisibility(View.GONE);
    layoutTaskThreeB.setVisibility(View.GONE);
    layoutTaskFour.setVisibility(View.GONE);
    dayTaskCheckboxGrp.setVisibility(View.GONE);
    setETEmpty();
    uncheckWeekDaysCB();
    repetitionTaskRG.clearCheck();
    typeTaskRG.clearCheck();
    noneTaskRB.setChecked(true);
    miscRB.setChecked(true);
}

39. EventInput#resetFields()

Project: eeVee-Final-Presentation
File: EventInput.java
public void resetFields() {
    RadioButton miscRB = (RadioButton) typeEventRG.findViewById(7);
    selectingTimeDoneEventA = false;
    startDateStoreStringEventA = "";
    endDateStoreStingEventA = "";
    startTimeEvent.InitialiseTimeVariables();
    endTimeEvent.InitialiseTimeVariables();
    startTimeEventA.InitialiseTimeVariables();
    endTimeEventA.InitialiseTimeVariables();
    regnTimeEvent.InitialiseTimeVariables();
    startDateEvent.InitialiseDateVariables();
    endDateEvent.InitialiseDateVariables();
    startDateEventB.InitialiseDateVariables();
    endDateEventB.InitialiseDateVariables();
    regnDateEvent.InitialiseDateVariables();
    durationEvent.initialiseVariables();
    layoutEventOne.setVisibility(View.VISIBLE);
    layoutEventTwo.setVisibility(View.GONE);
    layoutEventThree.setVisibility(View.GONE);
    layoutEventThreeA.setVisibility(View.GONE);
    layoutEventThreeB.setVisibility(View.GONE);
    layoutEventFour.setVisibility(View.GONE);
    layoutEventFive.setVisibility(View.GONE);
    layoutEventSix.setVisibility(View.GONE);
    dayEventCheckboxGrp.setVisibility(View.GONE);
    setETEmpty();
    uncheckWeekDaysCB();
    repetitionEventRG.clearCheck();
    typeEventRG.clearCheck();
    noneEventRB.setChecked(true);
    miscRB.setChecked(true);
}

40. EditAndViewTask#setTaskType()

Project: eeVee-Final-Presentation
File: EditAndViewTask.java
public void setTaskType(String type) {
    int i;
    for (i = 0; i < typeSize; i++) {
        String temp = Constants.FILTERS.typeFilters[i];
        if (temp.matches(type))
            break;
    }
    RadioButton typeToBeCheckedRB = (RadioButton) typeTaskRG.findViewById(i + 1);
    typeToBeCheckedRB.setChecked(true);
}

41. EditAndViewTask#resetFields()

Project: eeVee-Final-Presentation
File: EditAndViewTask.java
public void resetFields() {
    viewOnlyMode = true;
    RadioGroup typeTaskRGLocal = (RadioGroup) taskViewPanelLL.findViewById(R.id.typeTaskRG);
    RadioButton miscRB = (RadioButton) typeTaskRGLocal.findViewById(7);
    selectingTimeDoneTaskA = false;
    startDateStoreStringTaskA = "";
    endDateStoreStingTaskA = "";
    startTimeTask.InitialiseTimeVariables();
    endTimeTask.InitialiseTimeVariables();
    startTimeTaskA.InitialiseTimeVariables();
    endTimeTaskA.InitialiseTimeVariables();
    startDateTask.InitialiseDateVariables();
    endDateTask.InitialiseDateVariables();
    startDateTaskB.InitialiseDateVariables();
    endDateTaskB.InitialiseDateVariables();
    durationTask.initialiseVariables();
    layoutTaskThree.setVisibility(View.GONE);
    layoutTaskThreeA.setVisibility(View.GONE);
    layoutTaskThreeB.setVisibility(View.GONE);
    dayTaskCheckboxGrp.setVisibility(View.GONE);
    setETEmpty();
    uncheckWeekDaysCB();
    repetitionTaskRG.clearCheck();
    typeTaskRG.clearCheck();
    noneTaskRB.setChecked(true);
    miscRB.setChecked(true);
}

42. EditAndViewEvent#setEventType()

Project: eeVee-Final-Presentation
File: EditAndViewEvent.java
public void setEventType(String type) {
    int i;
    for (i = 0; i < typeSize; i++) {
        String temp = Constants.FILTERS.typeFilters[i];
        if (temp.matches(type))
            break;
    }
    RadioButton typeToBeCheckedRB = (RadioButton) typeEventRG.findViewById(i + 1);
    typeToBeCheckedRB.setChecked(true);
}

43. EditAndViewEvent#resetFields()

Project: eeVee-Final-Presentation
File: EditAndViewEvent.java
public void resetFields() {
    viewOnlyMode = true;
    RadioGroup typeEventRGLocal = (RadioGroup) eventViewPanelLL.findViewById(R.id.typeEventRG);
    RadioButton miscRB = (RadioButton) typeEventRGLocal.findViewById(7);
    selectingTimeDoneEventA = false;
    startDateStoreStringEventA = "";
    endDateStoreStingEventA = "";
    startTimeEvent.InitialiseTimeVariables();
    endTimeEvent.InitialiseTimeVariables();
    startTimeEventA.InitialiseTimeVariables();
    endTimeEventA.InitialiseTimeVariables();
    regnTimeEvent.InitialiseTimeVariables();
    startDateEvent.InitialiseDateVariables();
    endDateEvent.InitialiseDateVariables();
    startDateEventB.InitialiseDateVariables();
    endDateEventB.InitialiseDateVariables();
    regnDateEvent.InitialiseDateVariables();
    durationEvent.initialiseVariables();
    layoutEventThree.setVisibility(View.GONE);
    layoutEventThreeA.setVisibility(View.GONE);
    layoutEventThreeB.setVisibility(View.GONE);
    dayEventCheckboxGrp.setVisibility(View.GONE);
    setETEmpty();
    uncheckWeekDaysCB();
    repetitionEventRG.clearCheck();
    typeEventRG.clearCheck();
    noneEventRB.setChecked(true);
    miscRB.setChecked(true);
}

44. SortingDialogFragment#setFavoritesChecked()

Project: CineBuff
File: SortingDialogFragment.java
@Override
public void setFavoritesChecked() {
    RadioButton favorites = (RadioButton) mSortingOptionsGroup.findViewById(R.id.favorites);
    favorites.setChecked(true);
}

45. SortingDialogFragment#setHighestRatedChecked()

Project: CineBuff
File: SortingDialogFragment.java
@Override
public void setHighestRatedChecked() {
    RadioButton highestRated = (RadioButton) mSortingOptionsGroup.findViewById(R.id.highest_rated);
    highestRated.setChecked(true);
}

46. SortingDialogFragment#setPopularChecked()

Project: CineBuff
File: SortingDialogFragment.java
@Override
public void setPopularChecked() {
    RadioButton popular = (RadioButton) mSortingOptionsGroup.findViewById(R.id.most_popular);
    popular.setChecked(true);
}

47. ChannelBrowseActivity#onCreate()

Project: BotLibre
File: ChannelBrowseActivity.java
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void onCreate(Bundle savedInstanceState) {
    super.superOnCreate(savedInstanceState);
    setContentView(R.layout.activity_browse);
    resetLast();
    RadioButton radio = (RadioButton) findViewById(R.id.personalRadio);
    radio.setText("My Channels");
    Spinner sortSpin = (Spinner) findViewById(R.id.sortSpin);
    ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, new String[] { "connects", "connects today", "connects this week", "connects this month", "name", "date", "messages", "users" });
    sortSpin.setAdapter(adapter);
    HttpAction action = new HttpGetTagsAction(this, getType());
    action.execute();
    action = new HttpGetCategoriesAction(this, getType());
    action.execute();
}

48. ForumBrowseActivity#onCreate()

Project: BotLibre
File: ForumBrowseActivity.java
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void onCreate(Bundle savedInstanceState) {
    super.superOnCreate(savedInstanceState);
    setContentView(R.layout.activity_browse);
    resetLast();
    RadioButton radio = (RadioButton) findViewById(R.id.personalRadio);
    radio.setText("My Forums");
    Spinner sortSpin = (Spinner) findViewById(R.id.sortSpin);
    ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, new String[] { "connects", "connects today", "connects this week", "connects this month", "name", "date", "posts" });
    sortSpin.setAdapter(adapter);
    HttpAction action = new HttpGetTagsAction(this, getType());
    action.execute();
    action = new HttpGetCategoriesAction(this, getType());
    action.execute();
}

49. MainActivity#clickRadioButton()

Project: ud862-samples
File: MainActivity.java
@OnClick({ R.id.centerBtn, R.id.centerCropBtn, R.id.centerInsideBtn, R.id.fitCenterBtn, R.id.fitEndBtn, R.id.fitStartBtn, R.id.fitXYBtn, R.id.matrixBtn, R.id.noneBtn })
public void clickRadioButton(RadioButton view) {
    // Check to see what is clicked
    RadioButton checkedRadio = getSelectedRadio(view);
    if (checkedRadio != null && checkedRadio != view) {
        checkedRadio.setChecked(false);
    }
    // If currently checked, do nothing.
    imageView.setPadding(0, 0, 0, 0);
    switch((String) view.getText()) {
        case "NO!!!!":
            int px = dpToPx(32);
            imageView.setPadding(px, px, px, px);
            imageView.setScaleType(ScaleType.FIT_CENTER);
            break;
        case "CENTER":
            imageView.setScaleType(ScaleType.CENTER);
            break;
        case "CENTER_CROP":
            imageView.setScaleType(ScaleType.CENTER_CROP);
            break;
        case "CENTER_INSIDE":
            imageView.setScaleType(ScaleType.CENTER_INSIDE);
            break;
        case "FIT_CENTER":
            imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            break;
        case "FIT_END":
            imageView.setScaleType(ImageView.ScaleType.FIT_END);
            break;
        case "FIT_START":
            imageView.setScaleType(ImageView.ScaleType.FIT_START);
            break;
        case "FIT_XY":
            imageView.setScaleType(ImageView.ScaleType.FIT_XY);
            break;
        case "MATRIX":
            imageView.setScaleType(ImageView.ScaleType.MATRIX);
            imageView.setImageMatrix(matrix);
            break;
    }
// If different, alter view
}

50. ExplorerActivity#getMethod()

Project: SalesforceMobileSDK-Android
File: ExplorerActivity.java
private RestMethod getMethod(int methodRadioGroup) {
    RadioGroup radioGroup = (RadioGroup) findViewById(methodRadioGroup);
    RadioButton radioButton = (RadioButton) findViewById(radioGroup.getCheckedRadioButtonId());
    RestMethod method = RestMethod.valueOf((String) radioButton.getTag());
    return method;
}

51. FeedbackActivity#getSelectedFeedbackType()

Project: q-municate-android
File: FeedbackActivity.java
private String getSelectedFeedbackType() {
    int radioButtonID = feedbackTypesRadioGroup.getCheckedRadioButtonId();
    RadioButton radioButton = (RadioButton) feedbackTypesRadioGroup.findViewById(radioButtonID);
    return radioButton.getText().toString();
}

52. FileChooser#onDeleteFile()

Project: MifareClassicTool
File: FileChooser.java
/**
     * Delete the selected file and update the file list.
     * @see #updateFileIndex(File)
     */
private void onDeleteFile() {
    RadioButton selected = (RadioButton) findViewById(mGroupOfFiles.getCheckedRadioButtonId());
    File file = new File(mDir.getPath(), selected.getText().toString());
    file.delete();
    mIsDirEmpty = updateFileIndex(mDir);
}

53. FileChooser#onFileChosen()

Project: MifareClassicTool
File: FileChooser.java
/**
     * Finish the Activity with an Intent containing
     * {@link #EXTRA_CHOSEN_FILE} and {@link #EXTRA_CHOSEN_FILENAME} as result.
     * You can catch that result by overriding onActivityResult() in the
     * Activity that called the file chooser via startActivityForResult().
     * @param view The View object that triggered the function
     * (in this case the choose file button).
     * @see #EXTRA_CHOSEN_FILE
     * @see #EXTRA_CHOSEN_FILENAME
     */
public void onFileChosen(View view) {
    RadioButton selected = (RadioButton) findViewById(mGroupOfFiles.getCheckedRadioButtonId());
    Intent intent = new Intent();
    File file = new File(mDir.getPath(), selected.getText().toString());
    intent.putExtra(EXTRA_CHOSEN_FILE, file.getPath());
    intent.putExtra(EXTRA_CHOSEN_FILENAME, file.getName());
    setResult(Activity.RESULT_OK, intent);
    finish();
}

54. RadioGroupPreference#getSelectedValue()

Project: meiShi
File: RadioGroupPreference.java
private String getSelectedValue() {
    int radioButtonId = radioGroup.getCheckedRadioButtonId();
    RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId);
    return (String) radioButton.getText();
}

55. AccountFragment#onCheckedChanged()

Project: iosched
File: AccountFragment.java
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    RadioButton rb = (RadioButton) group.findViewById(checkedId);
    mSelectedAccount = rb.getText().toString();
    LOGD(TAG, "Checked: " + mSelectedAccount);
    if (mActivity instanceof WelcomeFragmentContainer) {
        ((WelcomeFragmentContainer) mActivity).setPositiveButtonEnabled(true);
    }
}

56. DetermineOrientationActivity#updateSelectedSensor()

Project: gast-lib
File: DetermineOrientationActivity.java
/**
     * Updates the views for when the selected sensor is changed
     */
private void updateSelectedSensor() {
    // Clear any current registrations
    sensorManager.unregisterListener(this);
    // Determine which radio button is currently selected and enable the
    // appropriate sensors
    selectedSensorId = sensorSelector.getCheckedRadioButtonId();
    if (selectedSensorId == R.id.accelerometerMagnetometer) {
        sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), RATE);
        sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), RATE);
    } else if (selectedSensorId == R.id.gravityMagnetometer) {
        sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY), RATE);
        sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), RATE);
    } else if ((selectedSensorId == R.id.gravitySensor)) {
        sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY), RATE);
    } else {
        sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR), RATE);
    }
    // Update the label with the currently selected sensor
    RadioButton selectedSensorRadioButton = (RadioButton) findViewById(selectedSensorId);
    selectedSensorValue.setText(selectedSensorRadioButton.getText());
}

57. ImitateWandoujiaActivity#tabIndex()

Project: AndroidStudyDemo
File: ImitateWandoujiaActivity.java
private void tabIndex() {
    mMainSV.setVisibility(View.VISIBLE);
    mMainVP.setVisibility(View.GONE);
    RadioButton rbChild;
    int childCount = mMNavMidRG.getChildCount();
    for (int childIndex = 0; childIndex < childCount; childIndex++) {
        rbChild = (RadioButton) mMNavMidRG.getChildAt(childIndex);
        rbChild.setChecked(false);
    }
}

58. OpenMenuItemView#insertCompoundButton()

Project: Android-tv-widget
File: OpenMenuItemView.java
/**
     * ????view.
     */
private void insertCompoundButton(IOpenMenuItem itemData) {
    mCompoundButton = new RadioButton(mContext);
    addView(mCompoundButton, 0);
}