Annerajb Annerajb - 1 year ago 107
Android Question

How to receive a event on android checkbox check change?

what would be the correct way of receiving and sending a event when a check box get's enable or disable. In c# i could just easily double click and all the code would be done for me. but in android it appears to be a bit more obscure. i thought of using the touch event handlers but then if the user has a keyboard it wont detect the change since it's not touch. I figure android should have a native event for check box state change.

Answer Source
CheckBox repeatChkBx = ( CheckBox ) findViewById( );
repeatChkBx.setOnCheckedChangeListener(new OnCheckedChangeListener()
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
        if ( isChecked )
            // perform logic

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download