官术网_书友最值得收藏!

  • 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();
    }
}
主站蜘蛛池模板: 陆河县| 中阳县| 济阳县| 开封县| 修文县| 钟山县| 宁河县| 江阴市| 珲春市| 南丹县| 紫阳县| 阿坝| 延边| 佛学| 个旧市| 井研县| 彭州市| 儋州市| 胶南市| 驻马店市| 菏泽市| 德安县| 南投市| 延吉市| 都兰县| 攀枝花市| 万盛区| 浮山县| 三台县| 东光县| 南乐县| 屏东市| 哈尔滨市| 井研县| 靖远县| 兴化市| 黎川县| 犍为县| 菏泽市| 安化县| 察雅县|