- Android Wear Projects
- Ashok Kumar S
- 55字
- 2021-07-15 17:17:57
Saving notes
The saving note method accepts two arguments, Note and Context. When a note is not empty, it opens up the SharedPreference editor and saves the data:
public static void saveNote(Note note, Context context) { if (note != null) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(note.getId(), note.getNotes()); editor.apply(); } }