dimanche 23 janvier 2022

How do I set my checkbox checked by default after a certain action is performed in Android Studio?

everyone! Please help with finding a solution to this problem. I would very much appreciate it! I have an activity with a list of checkboxes. A checkbox and after clicking it, the next action is called, performed, and completed. Afterward, the action is completed, the app returns to the action with a list of checkboxes and now I want the used checkbox to be checked by default and unable to be clicked again. Please help!

This is what I tried to do but was not successful checkbox becomes unchecked when I return to the action:

P2106.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if(isChecked){
                Intent move = new Intent(GeneralRoute.this, ScanTest.class);
                startActivity(move);
                P2106.setChecked(true);
            }
        }
    });



Aucun commentaire:

Enregistrer un commentaire