title: Disable Android checkbox listener
body: <p>I am working on a data collection application that while in an active state locks the screen to prevent errant user interaction. I would like to &quot;lock&quot; the checkbox while in this state to prevent the user from <em>checking or unchecking the box</em>. While other buttons on the screen still &quot;click&quot; when in this state, (listener is active) their events are not executed when the boolean bLockedScreen == true. I'd like for my boolean flag (bLockedScreen) when true to disable the check box listener.</p>
  <p>What is the best way to go about doing this? TIA</p>
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
              ...
              ckbxVerbose = (CheckBox) v.findViewById(R.id.ckbxVerbose);
              return v;
  }
  public void verbose(){
      if(ckbxVerbose.isChecked()){
          //do something
  }
  </code></pre>
  <p><strong>Update:</strong> Resolved this by putting,</p>
  <pre><code> ckbxVerbose.setEnabled(false);
  </code></pre>
  <p>in the method that set the boolean flag to disable screen widgets. Will likely do this as well with the other buttons that are inactive while data is being collected. Thank you Prince Ali for your answer.</p>