当前位置: 首页>>代码示例>>Java>>正文


Java RadioGroup.setOnCheckedChangeListener方法代码示例

本文整理汇总了Java中android.widget.RadioGroup.setOnCheckedChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java RadioGroup.setOnCheckedChangeListener方法的具体用法?Java RadioGroup.setOnCheckedChangeListener怎么用?Java RadioGroup.setOnCheckedChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.RadioGroup的用法示例。


在下文中一共展示了RadioGroup.setOnCheckedChangeListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onViewCreated

import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mRadioGroup = (RadioGroup) view.findViewById(R.id.radio_group);
    mShowAllButton = (RadioButton) view.findViewById(R.id.show_all);
    mRedactSensitiveButton = (RadioButton) view.findViewById(R.id.redact_sensitive);

    mRadioGroup.setOnCheckedChangeListener(this);

    // Disable buttons according to policy.
    if (isSecureNotificationsDisabled(getActivity())) {
        mShowAllButton.setEnabled(false);
        mRedactSensitiveButton.setEnabled(false);
    } else if (isUnredactedNotificationsDisabled(getActivity())) {
        mShowAllButton.setEnabled(false);
    }
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:18,代码来源:RedactionInterstitial.java

示例2: onCreate

import android.widget.RadioGroup; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    radioGroup = (RadioGroup) findViewById(R.id.radioGroup_choose_game);
    radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
            RadioButton buttonChoiceGame = (RadioButton) findViewById(checkedId);
            String choiceOfGame = buttonChoiceGame.getText().toString();
            switch (choiceOfGame) {
                case "Single Player":
                    startActivity(new Intent(SettingsActivity.this, GameActivity.class));
                    break;
                case "Multiplayer":
                    Toast.makeText(SettingsActivity.this, "This feature is not available yet. Coming soon", Toast.LENGTH_SHORT).show();
                    break;
                default:
                    startActivity(new Intent(SettingsActivity.this, GameActivity.class));
            }
        }
    });


}
 
开发者ID:speaknomadic,项目名称:Cephalopod-for-Android,代码行数:29,代码来源:SettingsActivity.java

示例3: onViewCreated

import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public void onViewCreated(final View view, @Nullable final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    final RadioGroup settingsGroup = view.findViewById(R.id.group_network_settings);
    onSettingsChangeListener = new MuteableOnCheckedChangeListener((group, checkedId) -> {
        if (checkedId == successButton.getId()) {
            presenter.onSuccessSet();
        } else if (checkedId == timeoutButton.getId()) {
            presenter.onTimeoutSet();
        } else if (checkedId == errorButton.getId()) {
            presenter.onErrorSet();
        }
    });
    settingsGroup.setOnCheckedChangeListener(onSettingsChangeListener);
}
 
开发者ID:dmitrikudrenko,项目名称:MDRXL,代码行数:17,代码来源:SettingsFragment.java

示例4: createViews

import android.widget.RadioGroup; //导入方法依赖的package包/类
private void createViews() {
    findViewById(R.id.button).setOnClickListener(this);
    tvTitle = (TextView) findViewById(R.id.tvTitle);
    etPhone = (EditText) findViewById(R.id.etPhone);
    etMail = (EditText) findViewById(R.id.etMail);
    etAccount = (EditText) findViewById(R.id.etAccount);
    etAmount = (EditText) findViewById(R.id.etAmount);
    radioGroup = (RadioGroup) findViewById(R.id.radioGroup);
    llMain = (LinearLayout) findViewById(R.id.llMain);

    radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
            etPhone.setVisibility(checkedId == R.id.rbPhone ? View.VISIBLE : View.GONE);
            etMail.setVisibility(checkedId == R.id.rbEmail ? View.VISIBLE : View.GONE);
            etAccount.setVisibility(checkedId == R.id.rbAccount ? View.VISIBLE : View.GONE);

            tvTitle.setText(getSelectedTitle());


        }
    });
}
 
开发者ID:paparateam,项目名称:papara-android,代码行数:24,代码来源:MainActivity.java

示例5: FragmentTabAdapter

import android.widget.RadioGroup; //导入方法依赖的package包/类
public FragmentTabAdapter(FragmentActivity fragmentActivity,
						  List<Fragment> fragments, int fragmentContentId, RadioGroup rgs) {
	this.fragments = fragments;
	this.rgs = rgs;
	this.fragmentActivity = fragmentActivity;
	this.fragmentContentId = fragmentContentId;

	//启动Fragment的流程
	//获得Fragment的事务,添加,执行
	FragmentTransaction ft = fragmentActivity.getSupportFragmentManager()
			.beginTransaction();
	ft.add(fragmentContentId, fragments.get(0));
	ft.commit();

	rgs.setOnCheckedChangeListener(this);
}
 
开发者ID:xdstudent,项目名称:ZhiHuIndex-master,代码行数:17,代码来源:FragmentTabAdapter.java

示例6: onCreateView

import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public View onCreateView(
        final LayoutInflater inflater,
        final @Nullable ViewGroup container,
        final @Nullable Bundle savedInstanceState) {

    final View picker = inflater.inflate(R.layout.fragment_category_picker, container, false);

    categories = (RadioGroup) picker.findViewById(R.id.categories);
    categoryLabel = (TextSwitcher) picker.findViewById(R.id.selected_category);

    categories.setOnCheckedChangeListener(new IconPickerWrapper(categoryLabel));
    categories.check(R.id.other);

    return picker;
}
 
开发者ID:PacktPublishing,项目名称:Hands-On-Android-UI-Development,代码行数:17,代码来源:CategoryPickerFragment.java

示例7: onCreate

import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	getActionBar().setDisplayHomeAsUpEnabled(true);
	setContentView(R.layout.activity_whatsapp_config);

	whatsappCheckbox = (CheckBox) findViewById(R.id.whatsapp_notification_checkbox);
	whatsappGroupCheckbox = (CheckBox) findViewById(R.id.whatsappGroupCheckbox);
	radioGroup = (RadioGroup) findViewById(R.id.radioGroup1);
	radioDelay = (RadioButton) findViewById(R.id.radioDelay);
	radioOnRead = (RadioButton) findViewById(R.id.radio_after_read);
	radioAll = (RadioButton) findViewById(R.id.radio_notify_all);
	notificationFilterText = (EditText) findViewById(R.id.notification_filter);
	delayTimeText = (EditText) findViewById(R.id.delay_time);
	whatsappCheckbox.setOnCheckedChangeListener(new WhatsappCheckBoxListener());
	radioGroup.setOnCheckedChangeListener(new WhatsappAlgorithmListener());

	try {
		loadConfiguration();
	}
	catch (JSONException e) {
		ConfigurationManager.showConfigurationError(getApplicationContext());
		finish();
	}
}
 
开发者ID:masterjc,项目名称:bluewatcher,代码行数:26,代码来源:WhatsappConfigActivity.java

示例8: onCreateView

import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public View onCreateView(
        final LayoutInflater inflater,
        final @Nullable ViewGroup container,
        final @Nullable Bundle savedInstanceState) {

    final View picker = inflater.inflate(R.layout.fragment_category_picker, container, false);

    categories = (RadioGroup) picker.findViewById(R.id.categories);
    categoryLabel = (TextView) picker.findViewById(R.id.selected_category);

    categories.setOnCheckedChangeListener(new IconPickerWrapper(categoryLabel));
    categories.check(R.id.other);

    return picker;
}
 
开发者ID:PacktPublishing,项目名称:Hands-On-Android-UI-Development,代码行数:17,代码来源:CategoryPickerFragment.java

示例9: onCreate

import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_capture_claim);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton attach = (FloatingActionButton) findViewById(R.id.attach);
    attach.setOnClickListener(this);

    selectedDate = new DatePickerWrapper((TextView) findViewById(R.id.date));

    categories = (RadioGroup) findViewById(R.id.categories);
    categories.setOnCheckedChangeListener(
            new IconPickerWrapper((TextView) findViewById(R.id.selected_category))
    );

    categories.check(R.id.other);
}
 
开发者ID:PacktPublishing,项目名称:Hands-On-Android-UI-Development,代码行数:22,代码来源:CaptureClaimActivity.java

示例10: onCreate

import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting);

    final RadioGroup radioGroup = (RadioGroup) findViewById(R.id.format);

    final SharedPreferences preferences = getSharedPreferences("settings", MODE_PRIVATE);
    switch (preferences.getString("image_format", "jpeg")) {
        case "jpeg":
            ((RadioButton) radioGroup.getChildAt(0)).setChecked(true);
            break;
        case "png":
            ((RadioButton) radioGroup.getChildAt(1)).setChecked(true);
            break;
    }

    radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
            switch (checkedId) {
                case R.id.jpeg:
                    preferences.edit().putString("image_format", "jpeg").apply();
                    Snackbar.make(radioGroup, "Format was set to JPEG.", Snackbar.LENGTH_SHORT).show();
                    break;
                case R.id.png:
                    preferences.edit().putString("image_format", "png").apply();
                    Snackbar.make(radioGroup, "Format was set to PNG.", Snackbar.LENGTH_SHORT).show();
                    break;
            }
        }
    });
}
 
开发者ID:CosmosA,项目名称:Metis,代码行数:34,代码来源:SettingActivity.java

示例11: initUi

import android.widget.RadioGroup; //导入方法依赖的package包/类
@SuppressLint("ShowToast")
private void initUi() {
	mResultEditText = (EditText) findViewById(R.id.edt_result);
	mAuthidEditText = (EditText) findViewById(R.id.set_authId);
	btn_start_record = (Button) findViewById(R.id.isv_reocrd);
	btn_start_record.setOnTouchListener(VocalVerifyDemo.this);
	findViewById(R.id.isv_getpassword).setOnClickListener(VocalVerifyDemo.this);
	findViewById(R.id.isv_search).setOnClickListener(VocalVerifyDemo.this);
	findViewById(R.id.isv_delete).setOnClickListener(VocalVerifyDemo.this);
	findViewById(R.id.isv_identity).setOnClickListener(VocalVerifyDemo.this);


	mToast = Toast.makeText(VocalVerifyDemo.this, "", Toast.LENGTH_SHORT);
	mToast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0);

	mProDialog = new ProgressDialog(VocalVerifyDemo.this);
	mProDialog.setCancelable(true);
	mProDialog.setTitle("请稍候");
	// cancel进度框时,取消正在进行的操作
	mProDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

		@Override
		public void onCancel(DialogInterface dialog) {
			if (null != mIdVerifier) {
				mIdVerifier.cancel();
			}
		}
	});

	// 密码选择RadioGroup初始化
	mSstTypeGroup = (RadioGroup) findViewById(R.id.vocal_radioGroup1);
	mSstTypeGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
		@Override
		public void onCheckedChanged(RadioGroup group, int checkedId) {
			if( null == mIdVerifier ){
				// 创建单例失败,与 21001 错误为同样原因,参考 http://bbs.xfyun.cn/forum.php?mod=viewthread&tid=9688
				showTip( "创建对象失败,请确认 libmsc.so 放置正确,且有调用 createUtility 进行初始化" );
				return;
			}

			// 取消之前操作
			if (mIdVerifier.isWorking()) {
				mIdVerifier.cancel();
			}
			cancelOperation();

			switch (checkedId) {
				case R.id.vocal_radioVerify:
					// 设置会话类型为验证
					mSST = SST_VERIFY;
					mVerifyNumPwd = VerifierUtil.generateNumberPassword(8);

					StringBuffer strBuffer = new StringBuffer();
					strBuffer.append("您的验证密码:" + mVerifyNumPwd + "\n");
					strBuffer.append("请长按“按住说话”按钮进行验证!\n");
					mResultEditText.setText(strBuffer.toString());
					break;
				case R.id.vocal_radioEnroll:
					// 设置会话类型为验证
					mSST = SST_ENROLL;

					if (null == mNumPwdSegs) {
						// 首次注册密码为空时,调用下载密码
						downloadPwd();
					} else {
						mResultEditText.setText("请长按“按住说话”按钮进行注册\n");
					}
					break;
				default:
					break;
			}
		}
	});
}
 
开发者ID:SoulEaterVTT,项目名称:KotlinStudy,代码行数:75,代码来源:VocalVerifyDemo.java

示例12: onCreateView

import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    mSettings = inflater.inflate(R.layout.fragment_settings, container, false);
    mRadiolang = (RadioGroup) mSettings.findViewById(R.id.langradio);
    mConfirmButton = (AppCompatButton) mSettings.findViewById(R.id.confirmButton);
    String currentLocale = Locale.getDefault().getLanguage();
    switch (currentLocale) {
        case CA:
            mRadiolang.check(R.id.radiocat);
            mCurrentLang = CA;
            break;
        case ES:
            mRadiolang.check(R.id.radiocast);
            mCurrentLang = ES;
            break;
        case EN:
            mRadiolang.check(R.id.radioeng);
            mCurrentLang = EN;
            break;
        default:
            break;
    }
    mRadiolang.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            handleRadio(checkedId);
        }
    });
    mConfirmButton.setAlpha(DISABLED_ALPHA);
    mConfirmButton.setEnabled(false);
    mConfirmButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setLanguage(v);
        }
    });
    return mSettings;
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:40,代码来源:SettingsFragment.java

示例13: onCreate

import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_edit_issue);
    mIssuename = (EditText) findViewById(R.id.IssueName);
    mIssueDesc = (EditText) findViewById(R.id.descriptionTex);
    mPosesrisk = (RadioGroup) findViewById(R.id.risk);
    mImageView = (ImageView) findViewById(R.id.eventView);
    mRisk = false;
    mIssueAdapter = AdapterFactory.getInstance().getIssueAdapter(this);
    Spinner categorySpinner = (Spinner) findViewById(R.id.nameCategorySpinner);
    categorySpinner.setAdapter(new CategorySpinnerAdapter(getApplicationContext(),
            R.layout.text_and_icon_spinner_tem));
    categorySpinner.setSelection(categorySpinner.getCount());
    Intent intent = getIntent();
    Bundle data = intent.getBundleExtra(TAG_ISSUE);
    mIssue = (Issue) data.getSerializable(TAG_ISSUE);
    mIssuename.setText(mIssue.getTitle());
    mIssueDesc.setText(mIssue.getDescription());
    String url = mIssue.getPicture().getMedUrl();
    Glide.with(this).load(url).into(mImageView);
    Category[] categories = Category.values();
    for (int i = 0; i < categories.length; ++i) {
        if (mIssue.getCategory().equals(categories[i])) {
            categorySpinner.setSelection(i);
        }
    }
    if (mIssue.isRisk()) {
        mPosesrisk.check(R.id.yes);
        mRisk = true;
    } else mPosesrisk.check(R.id.no);
    Toolbar toolbar = (Toolbar) findViewById(R.id.create_issue_toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setTitle(getString(R.string.edit_issue));
    mPosesrisk.setOnCheckedChangeListener(mRadioListener);
    mPictureUpdated = false;
    setupCloseKeyboard(findViewById(android.R.id.content));
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:41,代码来源:EditIssueActivity.java

示例14: onCreateView

import android.widget.RadioGroup; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.pay_way,container,false);
    RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.payway);

    //默认选中支付宝
    radioGroup.check(R.id.paypal);
    savePayway("Paypal");

    radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
            if(checkedId==R.id.paypal){
                savePayway("PayPal");
            }
            else if(checkedId==R.id.alipay){
                savePayway("AliPay");
            }
            else if(checkedId==R.id.wechat){
                savePayway("Wechat Pay");
            }
            else if(checkedId==R.id.credit){
                savePayway("Credit Card");
            }
            else{
                savePayway("Bank Card");
            }
        }
    });
    return view;
}
 
开发者ID:Quick-Tip,项目名称:Quick-Tip-Consumer,代码行数:33,代码来源:PayWay.java

示例15: initRadioGroup

import android.widget.RadioGroup; //导入方法依赖的package包/类
private void initRadioGroup(View view){
    mGroup1=(RadioGroup)view.findViewById(R.id.group1);
    mGroup2=(RadioGroup)view.findViewById(R.id.group2);
    mGroup3=(RadioGroup)view.findViewById(R.id.group3);
    mGroup4=(RadioGroup)view.findViewById(R.id.group4);

    mGroup1.setOnCheckedChangeListener(mCheckedChangeListener);
    mGroup2.setOnCheckedChangeListener(mCheckedChangeListener);
    mGroup3.setOnCheckedChangeListener(mCheckedChangeListener);
    mGroup4.setOnCheckedChangeListener(mCheckedChangeListener);
}
 
开发者ID:ifadai,项目名称:SuperNote,代码行数:12,代码来源:ThemeChoicePreference.java


注:本文中的android.widget.RadioGroup.setOnCheckedChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。