java - I need to create a specific string from the data in shared preferences -
i've created app company, allows employees fill in timesheets, i've got working perfect except want create email string results of shared preferrences.
to elaborate, in shared prefs have load of gas metres qtys against them, if have been fitted put qty against them, want ask programmatically "if shared pref has number against show in string, if not don't show"
so string might like
e6 - 3 u16 - 7 g4 - 2
even though there 10 metres in list , i've read shared preferences show 1 numbers in them.
sorry rubbish description it's difficult put need words.
thanks mark
create simple class named "sessionmanager" & create function below in class: public void savecityvalues(context contxt, string cityresponse) { sharedpreferences fbpref = contxt.getsharedpreferences("citydata", 0); editor edit = fbpref.edit(); edit.putstring("cityresponse", cityresponse); edit.commit(); } use function save data in shared preference below : sessionmanager sm = new sessionmanager(); sm.savecityvalues(context,responsebody); use below statement use saved string : string city =
sharedpreferences sharedpreferences =caller.getsharedpreferences("citydata", context.mode_private); string cityresponse = sharedpreferences.getstring(key, "");
Comments
Post a Comment