SunshinePreferences.java 文件源码

java
阅读 45 收藏 0 点赞 0 评论 0

项目:android-dev-challenge 作者:
/**
 * Saves the time that a notification is shown. This will be used to get the ellapsed time
 * since a notification was shown.
 *
 * @param context Used to access SharedPreferences
 * @param timeOfNotification Time of last notification to save (in UNIX time)
 */
public static void saveLastNotificationTime(Context context, long timeOfNotification) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    SharedPreferences.Editor editor = sp.edit();
    String lastNotificationKey = context.getString(R.string.pref_last_notification);
    editor.putLong(lastNotificationKey, timeOfNotification);
    editor.apply();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号