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 "lock" the checkbox while in this state to prevent the user from checking or unchecking the box. While other buttons on the screen still "click" 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.
What is the best way to go about doing this? TIA
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
}
Update: Resolved this by putting,
ckbxVerbose.setEnabled(false);
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.