I tell you that I have been doing a project from a tabbed activity, where the tabs are based on fragments. In one of the fragments I have three CheckBox elements, and what I want to do is disable these CheckBox from another fragment. I have tried two methods but none has worked for me. I leave the code of the methods I want to call.
public static CheckBox checkDate,checkTime,checkMemory;
public static void setCheckDate(boolean enable) {
checkDate.setEnabled(enable);
}
public static void setCheckTime(boolean enable) {
checkTime.setEnabled(enable);
}
public static void setCheckMemory(boolean enable) {
checkMemory.setEnabled(enable);
}
The first method you use, in the other fragment.
SettingsFragment.setCheckDate(false);
SettingsFragment.setCheckTime(false);
SettingsFragment.setCheckMemory(false)
The second method you use:
SettingsFragment setCheckBox = (SettingsFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.fragment_container);
setCheckBox.setCheckDate(false);
setCheckBox.setCheckTime(false);
setCheckBox.setCheckMemory(false);
Someone who can help me with this problem please. Thanks in advance