mardi 9 juillet 2019

How to read checkbox isChecked from another fragment?

I just added a new blank fragment to my App and added 12 Checkboxes inside it. Now I need to read the isChecked property from another fragment. How I can do that.

I tried this but I get NullPointer exception when I try to use the variable.

View FiltersView = FilterEvents.newInstance().getView();//FilterEvents is another fragment

CheckBox F1_1 = FiltersView.findViewById(R.id.filter1_1);
CheckBox F1_2 = FiltersView.findViewById(R.id.filter1_2);
CheckBox F1_3 = FiltersView.findViewById(R.id.filter1_3);
CheckBox F1_4 = FiltersView.findViewById(R.id.filter1_4);
CheckBox F1_5 = FiltersView.findViewById(R.id.filter1_5);
CheckBox F1_6 = FiltersView.findViewById(R.id.filter1_6);




Aucun commentaire:

Enregistrer un commentaire