Example usage for android.widget RadioButton isChecked

List of usage examples for android.widget RadioButton isChecked

Introduction

In this page you can find the example usage for android.widget RadioButton isChecked.

Prototype

@ViewDebug.ExportedProperty
    @Override
    public boolean isChecked() 

Source Link

Usage

From source file:org.riksa.a3.fragment.CreateKeyPairFragment.java

private String getKeyType() throws ViewNotFoundException {
    RadioButton rsaButton = findView(RadioButton.class, R.id.pk_type_rsa);
    if (rsaButton.isChecked()) {
        return "RSA";
    }//from w  w  w  .j  av a  2 s.c  om
    return "DSA";
}

From source file:com.androzic.route.RouteStart.java

@SuppressLint("InflateParams")
@Override/*from  www  .  jav  a 2s .  c  om*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(getString(R.string.routestart_name));
    final View view = getActivity().getLayoutInflater().inflate(R.layout.act_route_start, null);
    builder.setView(view);
    builder.setPositiveButton(R.string.navigate, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            RadioButton forward = (RadioButton) view.findViewById(R.id.forward);
            int dir = forward.isChecked() ? NavigationService.DIRECTION_FORWARD
                    : NavigationService.DIRECTION_REVERSE;
            routeActionsCallback.onRouteNavigate(route, dir, -1);
            dismiss();
        }
    });
    updateRouteInfo(view);
    return builder.create();
}

From source file:com.pixby.texo.EditTools.PositionTool.java

@SuppressWarnings("ConstantConditions")
private RadioButton getCheckedButton() {
    View parentView = getView();//from w ww  . j a  v  a  2  s.  c  om
    for (int id : ButtonIdArray) {
        RadioButton b = (RadioButton) parentView.findViewById(id);
        if (b != null && b.isChecked()) {
            return b;
        }
    }
    return null;
}

From source file:it.andreascarpino.forvodroid.SettingsFragment.java

@Override
public void onStop() {
    SharedPreferences preferences = getActivity().getSharedPreferences(MainActivity.CONFIG_FILE,
            Context.MODE_PRIVATE);
    Editor editor = preferences.edit();//from   w w w  .  j  av  a2 s . c o  m

    EditText apiKey = (EditText) getActivity().findViewById(R.id.api_key);
    editor.putString(MainActivity.CONFIG_API_KEY, apiKey.getText().toString());

    EditText languages = (EditText) getActivity().findViewById(R.id.languages);
    editor.putString(MainActivity.CONFIG_LANGUAGES, languages.getText().toString());

    RadioButton ogg = (RadioButton) getActivity().findViewById(R.id.ogg);
    editor.putBoolean(MainActivity.CONFIG_OGG, ogg.isChecked());

    editor.commit();

    super.onStop();
}

From source file:com.vuze.android.remote.dialog.DialogFragmentRcmAuth.java

@Override
public void onResume() {
    super.onResume();
    AlertDialog d = (AlertDialog) getDialog();
    if (d != null) {
        final Button positiveButton = d.getButton(Dialog.BUTTON_POSITIVE);
        final RadioButton rbPre = (RadioButton) d.findViewById(R.id.rcm_rb_pre);
        final RadioButton rbAll = (RadioButton) d.findViewById(R.id.rcm_rb_all);

        all = rbAll.isChecked();

        positiveButton.setEnabled(rbPre.isChecked() || rbAll.isChecked());

        OnCheckedChangeListener l = new CompoundButton.OnCheckedChangeListener() {
            @Override//from ww  w . j a  v a 2 s .  c o m
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                positiveButton.setEnabled(rbPre.isChecked() || rbAll.isChecked());
                all = rbAll.isChecked();
            }
        };

        rbPre.setOnCheckedChangeListener(l);
        rbAll.setOnCheckedChangeListener(l);
    }
}

From source file:mx.openpay.android.example.AddCardActivity.java

public void saveCard(final View view) {
    final RadioButton radio1 = (RadioButton) this.findViewById(R.id.radioButton1);
    if (radio1.isChecked()) {
        this.addCard();
    } else {//from ww w .j  av  a2s  .  c o m
        this.addToken();
    }
}

From source file:org.anhonesteffort.flock.SelectServiceProviderFragment.java

private void initButtons() {
    getActivity().findViewById(R.id.button_next).setOnClickListener(new View.OnClickListener() {

        @Override/*from  ww w  .  j  a v  a  2  s.  co m*/
        public void onClick(View v) {
            RadioButton radioButtonOws = (RadioButton) getActivity()
                    .findViewById(R.id.radio_button_service_ows);

            if (radioButtonOws.isChecked())
                handlePromptNewOrExistingAccount();

            else {
                fragmentActivity.setServiceProvider(SetupActivity.SERVICE_PROVIDER_OTHER);
                fragmentActivity.updateFragmentUsingState(SetupActivity.STATE_TEST_SERVICE_PROVIDER);
            }
        }

    });
}

From source file:com.zns.comicdroid.dialog.AuthorIllustratorDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    final int comicId = getArguments().getInt("ComicId");
    final String[] names = getArguments().getStringArray("Names");

    LayoutInflater inflater = getActivity().getLayoutInflater();

    final LinearLayout parent = new LinearLayout(getActivity());
    parent.setOrientation(1);//from ww  w.ja  v a 2s  .c o  m
    final View viewHead = inflater.inflate(R.layout.dialog_author_illustrator_head, null);
    parent.addView(viewHead);
    for (String name : names) {
        final View view = inflater.inflate(R.layout.dialog_author_illustrator, null);
        ((TextView) view.findViewById(R.id.tvName)).setText(name);
        parent.addView(view);
    }
    builder.setView(parent);

    builder.setPositiveButton(getResources().getString(R.string.common_save),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    String authors = "";
                    String illustrators = "";
                    for (int i = 1; i < parent.getChildCount(); i++) //Start at 1 to skip header
                    {
                        View child = parent.getChildAt(i);
                        TextView tvName = (TextView) child.findViewById(R.id.tvName);
                        RadioButton rbAuthor = (RadioButton) child.findViewById(R.id.rbIsAuthor);
                        RadioButton rbIllustrator = (RadioButton) child.findViewById(R.id.rbIsIllustrator);
                        if (rbAuthor.isChecked())
                            authors += tvName.getText() + ",";
                        if (rbIllustrator.isChecked())
                            illustrators += tvName.getText() + ",";
                    }
                    authors = authors.replaceAll("[,]+$", "");
                    illustrators = illustrators.replaceAll("[,]+$", "");
                    if (mAuthorIllustratorCallback != null)
                        mAuthorIllustratorCallback.onAuthorIllustratorDialogPositiveClick(comicId, authors,
                                illustrators);
                }
            })

            .setNegativeButton(getResources().getString(R.string.common_cancel),
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            AuthorIllustratorDialogFragment.this.getDialog().cancel();
                        }
                    });

    AlertDialog dialog = builder.create();
    return dialog;
}

From source file:tv.ouya.sample.game.OptionsActivity.java

public void onLevelRadioButtonClicked(View view) {
    RadioButton rb = ((RadioButton) view);
    if (!rb.isChecked()) {
        return;/*from  www. jav  a  2  s.c o  m*/
    }

    if (needsPurchasing(rb)) {
        try {
            requestPurchase(radioButtonToLevel.get(rb));
        } catch (Exception e) {
            Log.e(LOG_TAG, "Problem trying to purchase level", e);
        }
    } else {
        Options.Level level = radioButtonToLevel.get(view);
        selectLevel(level);
    }
}

From source file:com.app.blockydemo.ui.dialogs.NewVariableDialog.java

private void handleOkButton(View dialogView) {
    EditText variableNameEditText = (EditText) dialogView
            .findViewById(R.id.dialog_formula_editor_variable_name_edit_text);
    RadioButton localVariable = (RadioButton) dialogView
            .findViewById(R.id.dialog_formula_editor_variable_name_local_variable_radio_button);
    RadioButton globalVariable = (RadioButton) dialogView
            .findViewById(R.id.dialog_formula_editor_variable_name_global_variable_radio_button);

    String variableName = variableNameEditText.getText().toString();
    UserVariable newUserVariable = null;
    if (globalVariable.isChecked()) {
        if (ProjectManager.getInstance().getCurrentProject().getUserVariables().getUserVariable(variableName,
                ProjectManager.getInstance().getCurrentSprite()) != null) {

            Toast.makeText(getActivity(), R.string.formula_editor_existing_variable, Toast.LENGTH_LONG).show();

        } else {//from w ww  . j  a  v  a  2 s.com
            newUserVariable = ProjectManager.getInstance().getCurrentProject().getUserVariables()
                    .addProjectUserVariable(variableName);
        }
    } else if (localVariable.isChecked()) {
        newUserVariable = ProjectManager.getInstance().getCurrentProject().getUserVariables()
                .addSpriteUserVariable(variableName);
    }
    variableDialogListenerListFinishNewVariableDialog(newUserVariable);
}