I would like to get the booleanvalue of my checkbox that is in my Fragment and get that value in MainActivity . The Fragment is related to an Activity. Fragment:
@Override
public void onCreate (@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
}
Activity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(android.R.id.content,
new MyPreferenceFragment()).commit();
Can someone please explain to me how i make it. I just tried with an Interface but i got always a null error like the checkbox isnt initialize