java - Saving variable through app shutdown in android -
this question has answer here:
i want save variable through application shutdown. have heard sharedpreferences, didn't understand it. isn't there easier way store 1 variable. detailed explanation great, still beginning.
try saving shared preferences:
sharedpreferences sharedpreferences = preferencemanager.getdefaultsharedpreferences(getapplicationcontext()); sharedpreferences.edit().putstring("key","value").apply();
for getting shared preferences value:
sharedpreferences sharedpreferences = preferencemanager.getdefaultsharedpreferences(getapplicationcontext()); sharedpreferences.getstring("key","");
i hope help.
Comments
Post a Comment