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

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();
    }
}
主站蜘蛛池模板: 黔江区| 海阳市| 台州市| 西乌| 逊克县| 福安市| 玉林市| 博罗县| 边坝县| 扶风县| 台东县| 巴里| 大理市| 平昌县| 宁化县| 西丰县| 五家渠市| 刚察县| 南陵县| 辽源市| 邢台县| 越西县| 镇巴县| 莱西市| 平泉县| 浮梁县| 黔东| 忻城县| 平陆县| 沾化县| 庆城县| 商南县| 时尚| 馆陶县| 洪洞县| 赞皇县| 蚌埠市| 宾阳县| 桂林市| 贵溪市| 进贤县|