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


Java CheckBox.isChecked方法代码示例

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


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

示例1: question_1

import android.widget.CheckBox; //导入方法依赖的package包/类
/**
 * This method counter correct answers in question 1
 * "Which of the following are the primary goals of network security? (Choose 3 best answers)"
 */
public void question_1() {
    // Figure out if the user chose "Availability" answer
    CheckBox AvailabilityCheckBox = (CheckBox) findViewById(R.id.availability_checkbox);
    boolean hasAvailability = AvailabilityCheckBox.isChecked();

    if (hasAvailability) {
        increment_score();
    }

    // Figure out if the user chose "Integrity" answer
    CheckBox IntegrityCheckBox = (CheckBox) findViewById(R.id.integrity_checkbox);
    boolean hasIntegrity = IntegrityCheckBox.isChecked();

    if (hasIntegrity) {
        increment_score();
    }

    // Figure out if the user chose "Confidentiality" answer
    CheckBox ConfidentialityCheckBox = (CheckBox) findViewById(R.id.confidentiality_checkbox);
    boolean hasConfidentiality = ConfidentialityCheckBox.isChecked();

    if (hasConfidentiality) {
        increment_score();
    }
}
 
开发者ID:Liza-S,项目名称:IT-Security-Quiz-App,代码行数:30,代码来源:MainActivity.java

示例2: LightSettings

import android.widget.CheckBox; //导入方法依赖的package包/类
LightSettings(List<CheckBox> checkBoxes) {
    String lights = null;
    String colors = null;
    for (CheckBox cb : checkBoxes) {
        if (cb.isChecked()) {
            if (lights == null) {
                lights = String
                        .valueOf(((int[]) cb.getTag())[0]);
                colors = String
                        .valueOf(((int[]) cb.getTag())[1]);
            } else {
                lights += "," + ((int[]) cb.getTag())[0];
                colors += "," + ((int[]) cb.getTag())[1];
            }
        }
    }
    this.lights = Util.toIntArray(lights);
    this.colors = Util.toIntArray(colors);
}
 
开发者ID:j4velin,项目名称:HueNotifier,代码行数:20,代码来源:LightSettings.java

示例3: submitOrder

import android.widget.CheckBox; //导入方法依赖的package包/类
/**
 * This method is called when the order button is clicked.
 */
public void submitOrder(View view) {

    EditText nameField = findViewById(R.id.name_field);
    String name = nameField.getText().toString();
    Log.v("MainActivity", "Name: " + name);

    // Figure out if the user wants whipped cream topping
    CheckBox whippedCreamCheckBox = findViewById(R.id.whipped_cream_checkbox);
    boolean hasWhippedCream = whippedCreamCheckBox.isChecked();

    // Figure out if the user wants chocolate topping
    CheckBox chocolateCheckBox = findViewById(R.id.chocolate_checkbox);
    boolean hasChocolate = chocolateCheckBox.isChecked();

    // Calculate the price
    int price = calculatePrice(hasWhippedCream, hasChocolate);
    String priceMessage = createOrderSummary(name, price, hasWhippedCream, hasChocolate);

    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:")); // only email apps should handle this
    intent.putExtra(Intent.EXTRA_SUBJECT, "Just Java order for " + name);
    intent.putExtra(Intent.EXTRA_TEXT, priceMessage);
    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivity(intent);
    }
}
 
开发者ID:ItalianCoder,项目名称:Google-Developer-Challenge-Scholarship-Android-Basics,代码行数:30,代码来源:MainActivity.java

示例4: checkGenderSelected

import android.widget.CheckBox; //导入方法依赖的package包/类
private void checkGenderSelected( final CheckBox mGenderPreferenceCheckBoxFemale, final CheckBox mGenderPreferenceCheckBoxMale, final CheckBox mGenderPreferenceCheckBoxNonbinary,
                                  final CheckBox mGenderPreferenceCheckBoxOther ) {
    if (!mGenderPreferenceCheckBoxMale.isChecked() && !mGenderPreferenceCheckBoxFemale.isChecked() &&
            !mGenderPreferenceCheckBoxOther.isChecked() && !mGenderPreferenceCheckBoxNonbinary.isChecked()){
        errorFlag = true;
        mGenderPreferenceCheckBoxMale.setTextColor((getResources().getColor(R.color.colorSignUpError)));
        mGenderPreferenceCheckBoxFemale.setTextColor((getResources().getColor(R.color.colorSignUpError)));
        mGenderPreferenceCheckBoxOther.setTextColor((getResources().getColor(R.color.colorSignUpError)));
        mGenderPreferenceCheckBoxNonbinary.setTextColor((getResources().getColor(R.color.colorSignUpError)));
    } else {
        mGenderPreferenceCheckBoxMale.setTextColor(getResources().getColor(R.color.common_google_signin_btn_text_light));
        mGenderPreferenceCheckBoxFemale.setTextColor(getResources().getColor(R.color.common_google_signin_btn_text_light));
        mGenderPreferenceCheckBoxOther.setTextColor(getResources().getColor(R.color.common_google_signin_btn_text_light));
        mGenderPreferenceCheckBoxNonbinary.setTextColor(getResources().getColor(R.color.common_google_signin_btn_text_light));
    }
}
 
开发者ID:chrisqz95,项目名称:couch-potatoes,代码行数:17,代码来源:SignUpActivity.java

示例5: check1

import android.widget.CheckBox; //导入方法依赖的package包/类
public void check1(View view) {

        //checkbox 1
        CheckBox mandarino_uno = (CheckBox) findViewById(R.id.vota1);
        //checkbox 2
        CheckBox mandarino_due = (CheckBox) findViewById(R.id.vota2);
        //checkbox 3
        CheckBox mandarino_tre = (CheckBox) findViewById(R.id.vota3);

        mandarino_uno_checked=mandarino_uno.isChecked();

        if(mandarino_uno_checked) {
            orange = 1;
            mandarino_due.setChecked(false);
            mandarino_tre.setChecked(false);

        }else{
            orange=0;
        }
    }
 
开发者ID:Francescopaolo44,项目名称:AndroidApp-Deploy,代码行数:21,代码来源:Mandarini.java

示例6: check2

import android.widget.CheckBox; //导入方法依赖的package包/类
public void check2(View view) {

        //checkbox 1
        CheckBox mandarino_uno = (CheckBox) findViewById(R.id.vota1);
        //checkbox 2
        CheckBox mandarino_due = (CheckBox) findViewById(R.id.vota2);
        //checkbox 3
        CheckBox mandarino_tre = (CheckBox) findViewById(R.id.vota3);

        mandarino_due_checked=mandarino_due.isChecked();

        if(mandarino_due_checked) {
            orange = 2;
            mandarino_uno.setChecked(false);
            mandarino_tre.setChecked(false);
        }else{
            orange=0;
        }
    }
 
开发者ID:Francescopaolo44,项目名称:AndroidApp-Deploy,代码行数:20,代码来源:Mandarini.java

示例7: question_9

import android.widget.CheckBox; //导入方法依赖的package包/类
/**
 * This method counter correct answers in question 9
 * "Which of the following are the Integrity attacks? (Choose 3 best answers)"
 */
public void question_9() {
    // Figure out if the user chose "Data diddling" answer
    CheckBox DataDiddlingCheckBox = (CheckBox) findViewById(R.id.data_diddling_checkbox);
    boolean hasDataDiddlingCheckBox = DataDiddlingCheckBox.isChecked();

    if (hasDataDiddlingCheckBox) {
        increment_score();
    }

    // Figure out if the user chose "Password attack" answer
    CheckBox PasswordAttackCheckBox = (CheckBox) findViewById(R.id.password_attack_9_checkbox);
    boolean hasPasswordAttackCheckBox = PasswordAttackCheckBox.isChecked();

    if (hasPasswordAttackCheckBox) {
        increment_score();
    }

    // Figure out if the user chose "Botnet" answer
    CheckBox BotnetCheckBox = (CheckBox) findViewById(R.id.botnet_9_checkbox);
    boolean hasBotnetCheckBox = BotnetCheckBox.isChecked();

    if (hasBotnetCheckBox) {
        increment_score();
    }
}
 
开发者ID:Liza-S,项目名称:IT-Security-Quiz-App,代码行数:30,代码来源:MainActivity.java

示例8: submitOrder

import android.widget.CheckBox; //导入方法依赖的package包/类
/**
 * This method is called when the order button is clicked.
 */
public void submitOrder(View view) {
    CheckBox whippedCreamCheckBox = findViewById(R.id.whipped_cream_checkbox);
    boolean hasWhippedCream = whippedCreamCheckBox.isChecked();
    Log.v("MainActivity", "Has whipped cream: " + hasWhippedCream);

    int price = calculatePrice();
    displayMessage(createOrderSummary(price, hasWhippedCream));
}
 
开发者ID:ItalianCoder,项目名称:Google-Developer-Challenge-Scholarship-Android-Basics,代码行数:12,代码来源:MainActivity.java

示例9: canMoveFurther

import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
public boolean canMoveFurther() {
    checkBox = (CheckBox) getActivity().findViewById(R.id.cb_concordo);
    if (checkBox.isChecked()) {
        SharedPreferencesUtil.updateIntroStatus(getContext(), true);

        Intent intent = new Intent(getActivity(), MapActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        getActivity().finish();

    }
    return checkBox.isChecked();

}
 
开发者ID:gabriel-silva,项目名称:MapaDeIgarassu,代码行数:16,代码来源:TermsConditionsSlideFragment.java

示例10: refresh

import android.widget.CheckBox; //导入方法依赖的package包/类
void refresh() {
    for (int i = 0; i < views.length; i++) {
        if (views[i] != null) {
            Fach     current   = fachArray[i];
            CheckBox c         = cbs[i];
            TextView tvFach    = views[i].findViewById(R.id.fach_auswahl);
            TextView tvKuerzel = views[i].findViewById(R.id.kürzel_auswahl);
            TextView tvLehrer  = views[i].findViewById(R.id.lehrer_auswahl);
            if (c.isChecked()) {
                views[i].setEnabled(true);
                tvFach.setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
                tvKuerzel.setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
                tvLehrer.setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
            } else if (ausgewaehlteStunden[current.getTag() - 1][current.getStunde() - 1] || (current.getKuerzel().startsWith("IB") ? ausgewaehlteFaecher.contains(current.getKuerzel().substring(3, 6)) : ausgewaehlteFaecher.contains(current.getKuerzel().substring(0, 2)))) {
                views[i].setEnabled(false);
                tvFach.setTextColor(ContextCompat.getColor(getContext(), R.color.colorTextGreyed));
                tvKuerzel.setTextColor(ContextCompat.getColor(getContext(), R.color.colorTextGreyed));
                tvLehrer.setTextColor(ContextCompat.getColor(getContext(), R.color.colorTextGreyed));
            } else {
                views[i].setEnabled(true);
                tvFach.setTextColor(ContextCompat.getColor(getContext(), R.color.colorText));
                tvKuerzel.setTextColor(ContextCompat.getColor(getContext(), R.color.colorText));
                tvLehrer.setTextColor(ContextCompat.getColor(getContext(), R.color.colorText));
            }
        }
    }
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:28,代码来源:AuswahlActivity.java

示例11: confirmCombatAction

import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
protected void confirmCombatAction(InputMethodManager mgr, View addCombatantView) {

	CheckBox unarmedValue = addCombatantView.findViewById(R.id.unarmedValue);
	unarmed = unarmedValue.isChecked();

	super.confirmCombatAction(mgr, addCombatantView);
}
 
开发者ID:joaomneto,项目名称:TitanCompanion,代码行数:9,代码来源:RPAdventureCombatFragment.java

示例12: onClickCheckBox

import android.widget.CheckBox; //导入方法依赖的package包/类
@Override
public void onClickCheckBox(int p,CheckBox checkBox,TextView title)
{
    HashMap<String,String> map = mArrayList.get(p);

    if(checkBox.isChecked())
    {
        title.setPaintFlags(title.getPaintFlags()|Paint.STRIKE_THRU_TEXT_FLAG);
        MediaPlayer player = MediaPlayer.create(getContext(),R.raw.ding);
        player.setAudioStreamType(AudioManager.STREAM_MUSIC);

        if(player.isPlaying())
            player.stop();
        else
            player.start();


        mTodo.updateData(keyName,1,map.get("id"));
        mArrayList = mTodo.getData(keyName);

    }
    else
    {
        title.setPaintFlags(title.getPaintFlags()&(~Paint.STRIKE_THRU_TEXT_FLAG));
        mTodo.updateData(keyName,0,map.get("id"));
        mArrayList = mTodo.getData(keyName);

    }
}
 
开发者ID:Salman544,项目名称:Todo_App,代码行数:30,代码来源:TodoFragment.java

示例13: finish

import android.widget.CheckBox; //导入方法依赖的package包/类
/**
 * Return the details of the new habit to the calling activity
 * so that the habit can be created and added to the habit list.
 */
@Override
public void finish(){
    Intent data = new Intent();
    if (save){
        EditText name = (EditText) findViewById(R.id.titleEditText);
        EditText reason = (EditText) findViewById(R.id.reasonEditText);

        //Change days into a sequence of 1's and 0's
        //ie 1001100 = Sunday, Wednesday, Thursday.
        ArrayList<CheckBox> days = new ArrayList<CheckBox>();
        days.add((CheckBox) findViewById(R.id.sundayBox));
        days.add((CheckBox) findViewById(R.id.mondayBox));
        days.add((CheckBox) findViewById(R.id.tuesdayBox));
        days.add((CheckBox) findViewById(R.id.wednesdayBox));
        days.add((CheckBox) findViewById(R.id.thursdayBox));
        days.add((CheckBox) findViewById(R.id.fridayBox));
        days.add((CheckBox) findViewById(R.id.saturdayBox));

        String schedule = "";
        for (int i=0; i<days.size(); i++){
            CheckBox b = days.get(i);
            if (b != null){
                if (b.isChecked()){
                    schedule += "1";
                }else{
                    schedule += "0";
                }
            }
        }

        data.putExtra(MainActivity.EXTRA_HABIT_NAME, name.getText().toString());
        data.putExtra(MainActivity.EXTRA_HABIT_REASON, reason.getText().toString());
        data.putExtra(MainActivity.EXTRA_HABIT_STARTDATE, newdate.getTime());
        data.putExtra(MainActivity.EXTRA_HABIT_SCHEDULE, schedule);
    }
    setResult(RESULT_OK, data);
    super.finish();
}
 
开发者ID:CMPUT301F17T09,项目名称:GoalsAndHabits,代码行数:43,代码来源:NewHabit.java

示例14: onFlatShadingClicked

import android.widget.CheckBox; //导入方法依赖的package包/类
public void onFlatShadingClicked(@SuppressWarnings("unused") View unused) {
    CheckBox cb = (CheckBox) findViewById(R.id.flatShading_checkbox);
    mFlatShadingChecked = cb.isChecked();

    RenderHandler rh = mRenderThread.getHandler();
    if (rh != null) {
        rh.sendSetFlatShading(mFlatShadingChecked);
    }
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:10,代码来源:HardwareScalerActivity.java

示例15: submitOrder

import android.widget.CheckBox; //导入方法依赖的package包/类
/**
 * This method is called when the order button is clicked.
 */
public void submitOrder(View view) {
    EditText nameField = (EditText) findViewById(R.id.name_field);
    String name = nameField.getText().toString();

    // Figure out if the user wants whipped cream topping
    CheckBox whippedCreamCheckBox = (CheckBox) findViewById(R.id.whipped_cream_checkbox);
    boolean hasWhippedCream = whippedCreamCheckBox.isChecked();

    // Figure out if the user wants whipped cream topping
    CheckBox ChocolateCheckBox = (CheckBox) findViewById(R.id.chocolate_checkbox);
    boolean hasChocolate = ChocolateCheckBox.isChecked();

    // Calculate the price
    int price = calculatePrice(hasWhippedCream, hasChocolate);

    // Display the order summary on the screen
    String priceMessage = createOrderSummary(name, price, hasWhippedCream, hasChocolate);

    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:")); // only email apps should handle this
    intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.email) + name);
    intent.putExtra(Intent.EXTRA_TEXT, priceMessage);
    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivity(intent);
    }
}
 
开发者ID:Liza-S,项目名称:Android-Development-for-Beginners-by-Udacity,代码行数:30,代码来源:MainActivity.java


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