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


Java CheckBox.setOnCheckedChangeListener方法代码示例

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


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

示例1: onCreateView

import android.widget.CheckBox; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_select_distinct, container, false);

    ((CreateGroupChannelActivity) getActivity()).setState(CreateGroupChannelActivity.STATE_SELECT_DISTINCT);

    mListener = (CreateGroupChannelActivity) getActivity();

    mCheckBox = (CheckBox) rootView.findViewById(R.id.checkbox_select_distinct);
    mCheckBox.setChecked(true);
    mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mListener.onDistinctSelected(isChecked);
        }
    });

    return rootView;
}
 
开发者ID:narenkukreja,项目名称:quire,代码行数:21,代码来源:SelectDistinctFragment.java

示例2: initView

import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
public void initView(Bundle savedInstanceState, View view) {
    Slidr.attach(this);

    llContainer = (LinearLayout) findViewById(R.id.ll_container);
    cbAlpha = (CheckBox) findViewById(R.id.cb_alpha);
    btnRandomColor = (Button) findViewById(R.id.btn_random_color);
    tvStatusAlpha = (TextView) findViewById(R.id.tv_status_alpha);
    sbChangeAlpha = (SeekBar) findViewById(R.id.sb_change_alpha);

    cbAlpha.setOnCheckedChangeListener(mCheckedChangeListener);
    btnRandomColor.setOnClickListener(this);
    findViewById(R.id.btn_set_transparent).setOnClickListener(this);
    sbChangeAlpha.setOnSeekBarChangeListener(mColorListener);

    tvStatusAlpha.setText(String.valueOf(mAlpha));

    updateStatusBar();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:BarStatusSwipeBackActivity.java

示例3: prepareRestoreWalletDialog

import android.widget.CheckBox; //导入方法依赖的package包/类
private void prepareRestoreWalletDialog(final Dialog dialog) {
    final AlertDialog alertDialog = (AlertDialog) dialog;

    final View replaceWarningView = alertDialog
            .findViewById(R.id.restore_wallet_from_content_dialog_replace_warning);
    final boolean hasCoins = wallet.getBalance(BalanceType.ESTIMATED).signum() > 0;
    replaceWarningView.setVisibility(hasCoins ? View.VISIBLE : View.GONE);

    final EditText passwordView = (EditText) alertDialog
            .findViewById(R.id.import_keys_from_content_dialog_password);
    passwordView.setText(null);

    final ImportDialogButtonEnablerListener dialogButtonEnabler = new ImportDialogButtonEnablerListener(
            passwordView, alertDialog) {
        @Override
        protected boolean hasFile() {
            return true;
        }
    };
    passwordView.addTextChangedListener(dialogButtonEnabler);

    final CheckBox showView = (CheckBox) alertDialog.findViewById(R.id.import_keys_from_content_dialog_show);
    showView.setOnCheckedChangeListener(new ShowPasswordCheckListener(passwordView));
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:25,代码来源:RestoreWalletActivity.java

示例4: getCheckStatus

import android.widget.CheckBox; //导入方法依赖的package包/类
private void getCheckStatus(View view, final int position) {
    CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
    checkBox.setText(list.get(position));
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (buttonView.isChecked()) {
                checkStatus.set(position, true);
            }
            else {
                checkStatus.set(position, false);
            }
        }
    });
    checkBox.setChecked(checkStatus.get(position));
}
 
开发者ID:Akari10032,项目名称:12306_Android,代码行数:17,代码来源:SeatsAdapter.java

示例5: onCreate

import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    findViewById(R.id.btn_start_subactivity).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent();
            i.setClass(MainActivity.this, SubActivity.class);
            startActivity(i);
        }
    });

    mStallCb = (CheckBox) findViewById(R.id.stalling_cb);
    mStallCb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            if (mStallCb.isChecked()) {
                mStallCb.setText(R.string.stalling_enabled);
                mStallHandler.sendEmptyMessage(0);
            } else {
                mStallCb.setText(R.string.stalling_disabled);
            }
        }
    });
}
 
开发者ID:zhangjianli,项目名称:StallBuster,代码行数:27,代码来源:MainActivity.java

示例6: initView

import android.widget.CheckBox; //导入方法依赖的package包/类
private void initView() {
    for (int i = 0; i < checkBoxs.length; i++) {
        CheckBox fr = (CheckBox) findViewById(checkBoxs[i]);
        fr.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    if (buttonView.getId() == checkBoxs[0]) {
                        for (int i = 1; i < checkBoxs.length; i++) {
                            map.get(checkBoxs[i]).setChecked(false);
                        }
                    } else {
                        map.get(checkBoxs[0]).setChecked(false);
                    }
                }
            }
        });
        map.put(checkBoxs[i], fr);
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:21,代码来源:AlarmFrSettingActivity.java

示例7: onCreate

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

    mCbVoice = (CheckBox) findViewById(R.id.id_cb_voice);

    mCbVoice.setOnCheckedChangeListener(
            new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(
                        CompoundButton buttonView, boolean isChecked) {

                    if (isChecked) {
                        // 静音
                        VideoLiveWallpaper.voiceSilence(getApplicationContext());
                    } else {
                        VideoLiveWallpaper.voiceNormal(getApplicationContext());
                    }
                }
            });
}
 
开发者ID:WanAndroid,项目名称:LiveWallPaper,代码行数:23,代码来源:MainActivity.java

示例8: setMultiSelectItems

import android.widget.CheckBox; //导入方法依赖的package包/类
public void setMultiSelectItems(String[] multiSelectItems, boolean[] selectedItems, final OnMultiChoiceClickListener onMultiChoiceClickListener) {
    if (multiSelectItems != null && multiSelectItems.length > 0) {
        if (selectedItems.length != multiSelectItems.length) {
            throw new IllegalArgumentException("multi select items and boolean array size not equal");
        }
        selectableItemsContainer.removeAllViews();
        selectableItemsContainer.setVisibility(View.VISIBLE);
        for (int i = 0; i < multiSelectItems.length; i++) {
            String item = multiSelectItems[i];
            View view = getLayoutInflater().inflate(R.layout.cfdialog_multi_select_item_layout, null);
            CheckBox checkBox = (CheckBox) view.findViewById(R.id.cfdialog_multi_select_item_checkbox);
            checkBox.setText(item);
            checkBox.setChecked(selectedItems[i]);
            final int position = i;
            checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    if (onMultiChoiceClickListener != null) {
                        onMultiChoiceClickListener.onClick(CFAlertDialog.this, position, isChecked);
                    }
                }
            });
            selectableItemsContainer.addView(view);
        }
    } else {
        selectableItemsContainer.setVisibility(View.GONE);
    }
}
 
开发者ID:Codigami,项目名称:CFAlertDialog,代码行数:29,代码来源:CFAlertDialog.java

示例9: getItemView

import android.widget.CheckBox; //导入方法依赖的package包/类
public View getItemView(final int position, View convertView, ViewHolder holder) {
    CollectionFood food = (CollectionFood) getItem(position);
    if (food != null) {
        ImageView civIcon = (CircleImageView) holder.getView(R.id.civ_icon);
        if (!TextUtils.isEmpty(food.thumb_image_url)) {
            ImageLoader.getInstance().displayImage(food.thumb_image_url, civIcon,
                    ImageLoaderOptions.global((int) R.drawable.aa2));
        }
        ((TextView) holder.getView(R.id.tv_name)).setText(food.name);
        ((TextView) holder.getView(R.id.tv_calory)).setText(FoodUtils.showUnitValue(food
                .calory, false));
        ((TextView) holder.getView(R.id.tv_unit)).setText(FoodUtils.changeUnitAndWeight(food
                .weight, food.is_liquid, false));
        ImageView ivLight = (ImageView) holder.getView(R.id.iv_light);
        FoodUtils.switchToLight(food.health_light, ivLight);
        CheckBox cbSelect = (CheckBox) holder.getView(R.id.cb_select);
        if (this.isEdit) {
            cbSelect.setVisibility(0);
            ivLight.setVisibility(8);
            cbSelect.setOnCheckedChangeListener(new OnCheckedChangeListener() {
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    if (position < CollectionAdapter.this.mDataSelect.size()) {
                        CollectionAdapter.this.mDataSelect.set(position, Boolean.valueOf
                                (isChecked));
                    }
                }
            });
        } else {
            cbSelect.setVisibility(8);
            ivLight.setVisibility(0);
        }
        cbSelect.setChecked(((Boolean) this.mDataSelect.get(position)).booleanValue());
    }
    return convertView;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:36,代码来源:CollectionAdapter.java

示例10: TimeSpanPicker

import android.widget.CheckBox; //导入方法依赖的package包/类
public TimeSpanPicker(Context context, AttributeSet attrs, int defStyle)
{
	super(context, attrs, defStyle);

	this.context = context;

	final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	dialog = inflater.inflate(R.layout.time_span_dialog, this, true);

	timeSpan = new TimeSpan(-1);

	timeSpanEditText = (EditText) dialog.findViewById(R.id.timeSpanEditText);
	timeSpanEditText.setText("0");

	timeSpanSpinner = (Spinner) dialog.findViewById(R.id.timeSpanSpinner);
	timeSpanDisableCheckbox = (CheckBox) dialog.findViewById(R.id.timeSpanDisableCheckBox);

	timeSpanDisableCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
	{
		@Override
		public void onCheckedChanged(CompoundButton compoundButton, boolean b)
		{
			timeSpanEditText.setEnabled(!b);
			timeSpanSpinner.setEnabled(!b);
		}
	});

	adapter = ArrayAdapter.createFromResource(context, R.array.shareExpirationNames, android.R.layout.simple_spinner_item);
	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	timeSpanSpinner.setAdapter(adapter);

	timeSpanSpinner.setOnItemSelectedListener(this);
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:34,代码来源:TimeSpanPicker.java

示例11: ViewHolder

import android.widget.CheckBox; //导入方法依赖的package包/类
public ViewHolder(View itemView) {
    super(itemView);
    textView = (TextView) itemView.findViewById(R.id.label_name);
    icon = (ImageView) itemView.findViewById(R.id.label_icon);
    checkBox = (CheckBox) itemView.findViewById(R.id.checkBox);
    checkBox.setOnCheckedChangeListener(this);
}
 
开发者ID:AbduazizKayumov,项目名称:Flashcard-Maker-Android,代码行数:8,代码来源:RVLabelsAdapter.java

示例12: setUpView

import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
protected void setUpView(View view, Context context, Bundle savedInstanceState,
                         final SimpleFormDialog.DialogActions actions,
                         boolean isLastElement, boolean isOnlyElement) {

    checkBox = (CheckBox) view.findViewById(R.id.checkBox);

    // Label
    checkBox.setText(field.getText(context));

    // Check preset
    if (savedInstanceState != null) {
        checkBox.setChecked(savedInstanceState.getBoolean(SAVED_CHECK_STATE));
    } else {
        checkBox.setChecked(field.getInitialState(context));
    }

    // Positive button state for single element forms
    if (isOnlyElement) {
        checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                actions.updatePosButtonState();
            }
        });
    }

}
 
开发者ID:eltos,项目名称:SimpleDialogFragments,代码行数:29,代码来源:CheckViewHolder.java

示例13: onCreate

import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SEGAnalytics.screen("Device Setup: Manual network entry screen");
    softApSSID = getIntent().getParcelableExtra(EXTRA_SOFT_AP);
    wifiFacade = WifiFacade.get(this);

    setContentView(R.layout.activity_manual_network_entry);
    CheckBox secureCheckbox = Ui.findView(this, R.id.network_requires_password);
    secureCheckbox.setOnCheckedChangeListener(secureCheckListener);
    ParticleUi.enableBrandLogoInverseVisibilityAgainstSoftKeyboard(this);
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:13,代码来源:ManualNetworkEntryActivity.java

示例14: onCreate

import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting);
    RadioGroup rg_taking_clock = (RadioGroup) findViewById(R.id.rg_talking_clock);
    rb_halfhour = (RadioButton) findViewById(R.id.rb_halfhour);
    rb_hours = (RadioButton) findViewById(R.id.rb_hours);
    rb_noreport = (RadioButton) findViewById(R.id.rb_noreport);
    weel_startTime = (WheelView) findViewById(R.id.weel_start_time);
    weel_stopTime = (WheelView) findViewById(R.id.weel_stop_time);

    et_city = (EditText) findViewById(R.id.et_city);
    et_description = (EditText) findViewById(R.id.et_description);
    model = new SharePerferenceModel();
    model.read();

    CheckBox cb_tick = (CheckBox) findViewById(R.id.cb_tick);
    cb_tick.setChecked(model.isTickSound());
    cb_tick.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            model.setTickSound(b);
        }
    });
    CheckBox cb_trigger_screen = (CheckBox) findViewById(R.id.cb_trigger_screen);
    cb_trigger_screen.setChecked(model.isTriggerScreen());
    cb_trigger_screen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            model.setTriggerScreen(isChecked);
        }
    });

    Button btn_uninstall = (Button) findViewById(R.id.btn_uninstall);
    btn_uninstall.setOnClickListener(this);
    Button btn_about = (Button) findViewById(R.id.btn_about);
    btn_about.setOnClickListener(this);


    for (int i = 0; i < 48; i++) {
        int hours = i / 2;
        int minutes = i % 2 * 30;
        String timeString = String.format("%02d:%02d", hours, (minutes + 1));
        listTime[i] = timeString;
    }

    ArrayWheelAdapter<String> timeAdpater = new ArrayWheelAdapter<String>(this, listTime);
    weel_startTime.setViewAdapter(timeAdpater);
    ArrayWheelAdapter<String> durationAdapter = new ArrayWheelAdapter<String>(this, listTime);
    weel_stopTime.setViewAdapter(durationAdapter);
    initData();

    rg_taking_clock.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup radioGroup, int index) {
            int checkID = radioGroup.getCheckedRadioButtonId();
            switch (checkID) {
                case R.id.rb_halfhour:
                    model.setTypeHourPower(Constants.TALKING_HALF_AN_HOUR);
                    break;
                case R.id.rb_hours:
                    model.setTypeHourPower(Constants.TALKING_HOURS);
                    break;
                case R.id.rb_noreport:
                    model.setTypeHourPower(Constants.TALKING_NO_REPORT);
                    break;

            }

        }
    });
}
 
开发者ID:socoolby,项目名称:CoolClock,代码行数:73,代码来源:SettingActivity.java

示例15: initChechBox

import android.widget.CheckBox; //导入方法依赖的package包/类
private void initChechBox() {
    mCheckAll = (CheckBox) findViewById(R.id.cb_check_all);
    mCheckAll.setOnCheckedChangeListener(onCheckedChangeListener);
}
 
开发者ID:smuyyh,项目名称:StickyHeaderListView,代码行数:5,代码来源:MainActivity.java


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