Example usage for android.widget RadioGroup getId

List of usage examples for android.widget RadioGroup getId

Introduction

In this page you can find the example usage for android.widget RadioGroup getId.

Prototype

@IdRes
@ViewDebug.CapturedViewProperty
public int getId() 

Source Link

Document

Returns this view's identifier.

Usage

From source file:com.ubuntuone.android.files.fragment.AutoUploadSetupFragment.java

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    if (group.getId() == R.id.auto_upload_mode) {
        switch (checkedId) {
        case R.id.auto_upload_on_both:
            showMobileNotice();/*from ww w . j a v  a2s  .c o m*/
            break;
        case R.id.auto_upload_on_wifi:
            hideMobileNotice();
            break;
        case R.id.auto_upload_on_none:
            hideMobileNotice();
            break;

        default:
            Log.d(TAG, "unhandled onCheckedChanged source: " + group.getId());
            break;
        }
    }
}

From source file:com.mifos.mifosxdroid.online.SurveyQuestionFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_survey_question, container, false);
    ButterKnife.inject(this, view);
    thiscontext = container.getContext();
    mQuestionDatas = (new Gson()).fromJson(getArguments().getString(QUESTION_DATA), QuestionDatas.class);
    mScorecardValues = new ScorecardValues();

    tv_question.setText(mQuestionDatas.getText());

    ViewGroup hourButtonLayout = (ViewGroup) view.findViewById(R.id.radio1);
    for (int i = 0; i < mQuestionDatas.getResponseDatas().size(); i++) {
        button1 = new RadioButton(thiscontext);
        button1.setId(i);//  w  w w .j a v  a 2  s  .  c o m
        button1.setText(mQuestionDatas.getResponseDatas().get(i).getText());
        hourButtonLayout.addView(button1);
        radioGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            public void onCheckedChanged(RadioGroup mRadioGroup2, int checkedId2) {
                for (int j = 0; j < mRadioGroup2.getChildCount(); j++) {
                    btn = (RadioButton) mRadioGroup2.getChildAt(j);
                    int t = mRadioGroup2.getId();
                    Log.d(LOG_TAG, "" + t);

                    if (btn.getId() == checkedId2) {
                        answer = btn.getText().toString();
                        mScorecardValues.setQuestionId(mQuestionDatas.getQuestionId());
                        mScorecardValues
                                .setResponseId(mQuestionDatas.getResponseDatas().get(j).getResponseId());
                        mScorecardValues.setValue(mQuestionDatas.getResponseDatas().get(j).getValue());
                        mCallback.answer(mScorecardValues);
                        Log.d(LOG_TAG,
                                "Q R V" + mQuestionDatas.getQuestionId() + " "
                                        + mQuestionDatas.getResponseDatas().get(j).getResponseId() + " "
                                        + mQuestionDatas.getResponseDatas().get(j).getValue());
                        return;
                    }
                }
            }
        });
    }

    return view;
}

From source file:com.physphil.android.unitconverterultimate.fragments.ConversionFragment.java

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch (group.getId()) {
    case R.id.radio_group_from:
        mState.setFromId(checkedId);//  w ww  .ja  v  a 2  s. c  om
        break;

    case R.id.radio_group_to:
        mState.setToId(checkedId);
        break;
    }

    convert();
}