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

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();
    }
}
主站蜘蛛池模板: 邳州市| 武宁县| 囊谦县| 临漳县| 喀喇沁旗| 梅河口市| 清流县| 怀安县| 贵德县| 吐鲁番市| 巫山县| 洪湖市| 临泉县| 博野县| 岳普湖县| 万宁市| 江永县| 灌南县| 渭南市| 杭锦旗| 商城县| 东方市| 奎屯市| 凌海市| 阳东县| 佛坪县| 昌江| 望奎县| 游戏| 锦州市| 新蔡县| 泾川县| 临潭县| 开阳县| 丽水市| 博爱县| 鄂州市| 怀来县| 金阳县| 普安县| 涟水县|