- 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(); } }
推薦閱讀
- 高手是如何做產品設計的(全2冊)
- MySQL數據庫應用與管理 第2版
- C#程序設計(慕課版)
- Android 7編程入門經典:使用Android Studio 2(第4版)
- Mastering PHP Design Patterns
- CKA/CKAD應試教程:從Docker到Kubernetes完全攻略
- Nginx Essentials
- QGIS By Example
- Extreme C
- Illustrator CC平面設計實戰從入門到精通(視頻自學全彩版)
- Java并發編程之美
- Mastering Docker
- The Applied Data Science Workshop
- C#從入門到精通(微視頻精編版)
- 設計模式之禪