本文整理汇总了Java中android.widget.RadioGroup.OnCheckedChangeListener类的典型用法代码示例。如果您正苦于以下问题:Java OnCheckedChangeListener类的具体用法?Java OnCheckedChangeListener怎么用?Java OnCheckedChangeListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnCheckedChangeListener类属于android.widget.RadioGroup包,在下文中一共展示了OnCheckedChangeListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUserProperty
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
private void setUserProperty() {
this.picker_layout = (LinearLayout) findViewById(R.id.picker_layout);
TextView text = (TextView) findViewById(R.id.user_property_text);
this.hint = (TextView) findViewById(R.id.hint);
text.setText(R.string.ov);
((RadioGroup) findViewById(R.id.switch_bottom)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.yes:
UserMcGoView.this.setBottomVisible(Boolean.valueOf(false));
return;
case R.id.no:
UserMcGoView.this.setBottomVisible(Boolean.valueOf(true));
return;
default:
return;
}
}
});
}
示例2: initIpView
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
private void initIpView() {
this.cbIPConnect.setChecked(BlackTech.isIPConnectOpen());
this.cbIPConnect.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
BlackTech.setIPConnectOpen(isChecked);
String str = "IP直连已:%s";
Object[] objArr = new Object[1];
objArr[0] = BlackTech.isIPConnectOpen() ? "开启" : "关闭";
ChangeEnvironmentActivity.this.showMessage(ChangeEnvironmentActivity.this
.cbIPConnect, String.format(str, objArr));
ChangeEnvironmentActivity.this.showIPs();
}
});
String env = BlackTech.getApiEnvironment();
if (BlackTech.API_ENV_QA.equals(env)) {
this.rbQA.setChecked(true);
} else if (BlackTech.API_ENV_RC.equals(env)) {
this.rbRC.setChecked(true);
} else {
this.rbPRO.setChecked(true);
}
this.rgEnvironment.setOnCheckedChangeListener(this);
}
示例3: initLayout
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
/**
* 初始化Layout。
*/
private void initLayout() {
findViewById(R.id.tts_play).setOnClickListener(TtsDemo.this);
findViewById(R.id.tts_cancel).setOnClickListener(TtsDemo.this);
findViewById(R.id.tts_pause).setOnClickListener(TtsDemo.this);
findViewById(R.id.tts_resume).setOnClickListener(TtsDemo.this);
findViewById(R.id.image_tts_set).setOnClickListener(TtsDemo.this);
findViewById(R.id.tts_btn_person_select).setOnClickListener(TtsDemo.this);
mRadioGroup=((RadioGroup) findViewById(R.id.tts_rediogroup));
mRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.tts_radioCloud:
mEngineType = SpeechConstant.TYPE_CLOUD;
break;
default:
break;
}
}
} );
}
示例4: createTheDialog
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
public static AlertDialog createTheDialog(Context context,int titleId,OnCancelListener listener,
OnCheckedChangeListener checkedChangeListener,
android.widget.CompoundButton.OnCheckedChangeListener checkBoxChangeListener){
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.has_same_file_check, null);
AlertDialog dialog = new AlertDialog.Builder(context)
.setView(view)
.setTitle(titleId)
.setOnCancelListener(listener)
.create();
RadioGroup rg = (RadioGroup)view.findViewById(R.id.whichOperation);
rg.setOnCheckedChangeListener(checkedChangeListener);
CheckBox cb = (CheckBox)view.findViewById(R.id.doitasSame);
cb.setOnCheckedChangeListener(checkBoxChangeListener);
return dialog;
}
示例5: onCreate
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.history);
ButterKnife.inject(this);
((RadioGroup)findViewById(R.id.radioGroup)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch(checkedId) {
case R.id.radio09:
((ImageView)findViewById(R.id.image)).setImageDrawable(getResources().getDrawable(R.drawable.graph1));
break;
case R.id.radio10:
((ImageView)findViewById(R.id.image)).setImageDrawable(getResources().getDrawable(R.drawable.graph2));
break;
case R.id.radio11:
((ImageView)findViewById(R.id.image)).setImageDrawable(getResources().getDrawable(R.drawable.graph3));
break;
}
}
});
}
示例6: initSortByClick
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
private void initSortByClick() {
RadioGroup rgSortBy = (RadioGroup) findViewById(R.id. radioGroup1 );
rgSortBy.setOnCheckedChangeListener( new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup arg0, int arg1) {
RadioButton rbName = (RadioButton) findViewById(R.id. radioName );
RadioButton rbCity = (RadioButton) findViewById(R.id. radioCity );
if (rbName.isChecked()) {
getSharedPreferences("MyContactListPreferences", MODE_PRIVATE ).edit().putString( "sortfield" , "contactname" ).commit();
}
else if (rbCity.isChecked()) {
getSharedPreferences("MyContactListPreferences", MODE_PRIVATE ).edit().putString( "sortfield" , "city" ).commit();
}
else {
getSharedPreferences("MyContactListPreferences", MODE_PRIVATE ).edit().putString( "sortfield" , "birthday" ).commit();
}
}
});
}
示例7: createQuestionComponent
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
@Override
protected void createQuestionComponent(ViewGroup questionComponent) {
mRadioGroup = new RadioGroup(getActivity());
for (Option option : getOptions()) {
int optionId = getOptions().indexOf(option);
RadioButton radioButton = new RadioButton(getActivity());
radioButton.setText(option.getText());
radioButton.setId(optionId);
radioButton.setTypeface(getInstrument().getTypeFace(getActivity().getApplicationContext()));
radioButton.setLayoutParams(new RadioGroup.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
mRadioGroup.addView(radioButton, optionId);
}
getRadioGroup().setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group, int checkedId) {
setResponseIndex(checkedId);
}
});
questionComponent.addView(mRadioGroup);
beforeAddViewHook(questionComponent);
}
示例8: onGameInit
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
public void onGameInit() {
wordToEvaluateText = (TextView) findViewById(R.id.wordToEvaluate);
wordDifficultyRating = (RatingBar) findViewById(R.id.wordDifficultyRating);
continueButton = (Button) findViewById(R.id.continueButton);
submitEvaluation = (Button) findViewById(R.id.submitTranslation);
qualityGroup = (RadioGroup) findViewById(R.id.qualityGroup);
wordToEvaluateText.setText(word.getWord());
submitEvaluation.setVisibility(View.VISIBLE);
continueButton.setVisibility(View.INVISIBLE);
wordDifficultyRating.setEnabled(false);
qualityGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.is_a_word)
onYesSelected();
else if (checkedId == R.id.is_not_word)
onNoSelected();
else if (checkedId == R.id.i_dont_know)
onDontKnowSelected();
}
});
}
示例9: showEditDialog
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
public void showEditDialog()
{
if ( editDialog == null ) {
editDialogView = LayoutInflater.from(this).inflate(R.layout.publish_edit_dialog_view, null);
editDialogEditText = (EditText)editDialogView.findViewById(R.id.publish_edit_dialog_text);
radioGroup = (RadioGroup)editDialogView.findViewById(R.id.publish_edit_dialog_select);
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub
editDialogEditText.setText( ( ( RadioButton) group.findViewById(checkedId) ).getText().toString());
}
});
editDialog = new AlertDialog.Builder(this).setView(editDialogView).
setPositiveButton(R.string.dialog_button_sure, dialogClickListener).
setNegativeButton(R.string.dialog_button_cancel, null).setTitle(R.string.reblog).create();
}
editDialog.show();
}
示例10: onCreate
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(SampleList.THEME); //Used for theme switching in samples
super.onCreate(savedInstanceState);
setContentView(R.layout.text);
((TextView)findViewById(R.id.text)).setText(R.string.custom_navigation_content);
//Inflate the custom view
View customNav = LayoutInflater.from(this).inflate(R.layout.custom_view, null);
//Bind to its state change
((RadioGroup)customNav.findViewById(R.id.radio_nav)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
Toast.makeText(CustomNavigation.this, "Navigation selection changed.", Toast.LENGTH_SHORT).show();
}
});
//Attach to the action bar
getSupportActionBar().setCustomView(customNav);
getSupportActionBar().setDisplayShowCustomEnabled(true);
}
示例11: installListeners
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
@Override
protected void installListeners() {
// TODO Auto-generated method stub
mSexRadioGroup
.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub
if (checkedId == R.id.register_sex_female) {
mSex = Const.FEMALE;
} else {
mSex = Const.MALE;
}
}
});
}
示例12: onCreate
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
if (BuildConfig.DEBUG) {
Log.e(Constants.LOG, "onCreate called");
}
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
RadioGroup group1 = (RadioGroup) findViewById(R.id.orientation);
group1.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.horizontal:
group.setOrientation(LinearLayout.HORIZONTAL);
break;
case R.id.vertical:
group.setOrientation(LinearLayout.VERTICAL);
break;
}
}
});
}
示例13: initView
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
private void initView() {
float calWeightWithBmiAndHeigt;
if (this.user.begin_weight == 0.0f) {
calWeightWithBmiAndHeigt = Utils.calWeightWithBmiAndHeigt(22.0f, this.user.height);
} else {
calWeightWithBmiAndHeigt = this.user.begin_weight;
}
this.defaultWeight = calWeightWithBmiAndHeigt;
updateTargetView(this.user.targetWeight());
this.rvWeight.init(Utils.calWeightWithBmiAndHeigt(15.5f, this.user.height()), 200.0f,
this.defaultWeight, 1.0f, 10, new OnValueChangeListener() {
public void onValueChange(float value) {
if (!ProfileInitThreeFragment.this.isRemoved()) {
ProfileInitThreeFragment.this.updateWeightView(value);
}
}
});
this.rgTarget.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group, int checkedId) {
ProfileInitThreeFragment.this.target = Float.valueOf(String.valueOf(group
.findViewById(checkedId).getTag())).floatValue();
ProfileInitThreeFragment.this.updateTargetView(ProfileInitThreeFragment.this
.target);
}
});
if (this.user.target_weight > 0.0f) {
this.rgTarget.check(R.id.rb_target_lose_weight);
} else {
this.rgTarget.check(R.id.rb_target_keep);
}
updateDateView(this.user.beginDate());
}
示例14: initUi
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的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;
}
}
});
}
示例15: onCreate
import android.widget.RadioGroup.OnCheckedChangeListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
DeviceUuidFactory uuid = new DeviceUuidFactory(this);
uid = uuid.getDeviceUuid().toString();
emailEditText = (EditText)findViewById(R.id.email);
emailEditText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);//设置限制邮箱格式
userNameEditText = (EditText) findViewById(R.id.username);
passwordEditText = (EditText) findViewById(R.id.password);
confirmPwdEditText = (EditText) findViewById(R.id.confirm_password);
rg=(RadioGroup)findViewById(R.id.sex);
b1=(RadioButton)findViewById(R.id.male);
b2=(RadioButton)findViewById(R.id.female);
rg.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub
if(checkedId==b1.getId()){
sex = "1";
Toast.makeText(RegisterActivity.this,"男", Toast.LENGTH_LONG).show();
}
if(checkedId==b2.getId()){
sex = "2";
Toast.makeText(RegisterActivity.this,"女", Toast.LENGTH_LONG).show();
}
}
});
}