java - Trying to update shared preference from a Fragment Activity -
i'm building custom ringtone selector app. class called soundpicker
, extends fragmentactivity
. i'm trying save selected ringtone app's settings file.
here code:
string selectedresource = "blablabla"; sharedpreferences sharedpref = preferencemanager.getdefaultsharedpreferences(getbasecontext()); sharedpreferences.editor editor = sharedpref.edit(); editor.putstringset("notifications_new_message", selectedresource); editor.commit();
the problem error, refering new string i'm trying set - selectedresource
that's error get:
wrong 2nd argument type. found: 'java.lang.string', required: 'java.util.set'
putstringset (string, java.util.set) in editor cannot applied (string, java.lang.string)
what doing wrong here? thank you!
please careful, putstring , putstringset different method, use putstring instead
editor.putstring("notifications_new_message", selectedresource);
Comments
Post a Comment