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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -