Runtimeexception When Trying To Store Value Fetched From Server To Sharedpreferences Using Asynctask
i am using sharedpreferences to check the app is using for the first time or not.if the app is using for first time registration screen will show , and after that MainActivity will
Solution 1:
No, need to use sp from MainActivity by creating object of Activity for saving value in SharedPreferences in Registration screen because PreferenceManager.getDefaultSharedPreferences also return SharedPreferences instance which we can use for saving and key-value in it. Change :
MainActivity set = newMainActivity();
set.sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
to
SharedPreferencessp= PreferenceManager.getDefaultSharedPreferences(
getApplicationContext());
Post a Comment for "Runtimeexception When Trying To Store Value Fetched From Server To Sharedpreferences Using Asynctask"