I have a sharedpreferences which save and retrieve data correct. but problem is this when phone restart it give null value.
here is code which I have try
if(encodedImage_profile3!=null)
{
wallpaper_sharedprefrences_profile3 = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor edit = wallpaper_sharedprefrences_profile3.edit();
edit.putString(PROFILE2_WALLPAPER, encodedImage_profile3);
edit.commit();
// Toast.makeText(context, "new same image in prefrences", Toast.LENGTH_SHORT).show();
}
wallpaper_sharedprefrences_profile3 = PreferenceManager.getDefaultSharedPreferences(context);
final String load_wallpaper_profile3 =wallpaper_sharedprefrences_profile3.getString(PROFILE2_WALLPAPER, "");
I have also try this
if(encodedImage_profile3!=null)
{
wallpaper_sharedprefrences_profile3 = context.getSharedPreferences(PREF_PROFILE2_WALLPAPER, Context.MODE_PRIVATE);
SharedPreferences.Editor edit = wallpaper_sharedprefrences_profile3.edit();
edit.putString(PROFILE2_WALLPAPER, encodedImage_profile3);
edit.commit();
}
wallpaper_sharedprefrences_profile3 = context.getSharedPreferences(PREF_PROFILE2_WALLPAPER, Context.MODE_PRIVATE);
final String load_wallpaper_profile3 =wallpaper_sharedprefrences_profile3.getString(PROFILE2_WALLPAPER, "");