hello guys, got this code but it has an error.

any ideas? Thanks.

public void ListenerCheckAll() {

        Chbox0 = (CheckBox) findViewById(R.id.checkBox1);

        xAllButton = (Button) findViewById(R.id.button1);

        xAllButton.setOnClickListener(new OnClickListener() {  

            public void onClick(View vx) {

                Chbox0 = (CheckBox) findViewById(R.id.checkBox1);

                 boolean checked = ((CheckBox) vx).isChecked();

                       //this part has the error
                case R.id.CheckBox01:
                    if (checked){
                      "CheckBox1 is checked", Toast.LENGTH_SHORT).show();




Recommended Answers

All 3 Replies

With your number of posts you should know better then just drop code with no exact error

hi peter, log cat error actually is quite useless. i run it through the emulator the error message is quite general (not a specific error).

Just realised you are using switch statment and validating view ID. This is no longer safe. If you need to do that you should then doing it from if/else

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.