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

  • 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();
    }
}
主站蜘蛛池模板: 儋州市| 方正县| 天津市| 柳江县| 义马市| 澳门| 静宁县| 沁源县| 汉沽区| 南川市| 马尔康县| 望奎县| 灵台县| 车致| 芦山县| 木兰县| 寿光市| 南华县| 嘉兴市| 沾化县| 宁都县| 环江| 定安县| 民和| 西丰县| 宜良县| 札达县| 南雄市| 承德县| 如东县| 宁河县| 东乌| 华亭县| 布拖县| 东莞市| 长沙市| 枝江市| 宜丰县| 扎兰屯市| 陈巴尔虎旗| 南江县|