Skip to content Skip to sidebar Skip to footer

Shared Preferences In Fragment

Is it possible to make shared preferences in Fragment and than to read it in another activity? I tried to make like this shared preferences in Fragment, but then I can't get the va

Solution 1:

You can replece:

finalSharedPreferencespref= getActivity().getPreferences(0);

With:

finalSharedPreferencespref= PreferenceManager.getDefaultSharedPreferences(getActivity());

The last one belongs to the whole app.

Post a Comment for "Shared Preferences In Fragment"