Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String PREF_NAME = "pref_general"; private static final String LAST_CLICK_ADS = "LAST_CLICK_ADS"; public static void setLastClickAds(Context context, long value) { saveLong(context, LAST_CLICK_ADS, value); } /** * save long value to preference memory */ public static void saveLong(Context context, String key, long value) { if (context == null) return; SharedPreferences pref = context.getSharedPreferences(PREF_NAME, 0); SharedPreferences.Editor editor = pref.edit(); editor.putLong(key, value); editor.commit(); } }