- 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(); } }
推薦閱讀
- Beginning Java Data Structures and Algorithms
- Practical UX Design
- 區塊鏈架構與實現:Cosmos詳解
- Visual Basic程序設計(第3版):學習指導與練習
- Git高手之路
- Practical DevOps
- C語言程序設計實踐教程
- Java Web基礎與實例教程
- INSTANT OpenNMS Starter
- Java Web開發就該這樣學
- Unity 3D腳本編程:使用C#語言開發跨平臺游戲
- SQL Server 2008 R2數據庫技術及應用(第3版)
- 從零學Java設計模式
- AI自動化測試:技術原理、平臺搭建與工程實踐
- Python全棧開發:基礎入門