android - Shared preference with session timeout using countdowntimer -
i want using startcountdown timer method change preference value not worked.
private void startcountdowntimer(final string judul){ countdowntimer = new countdowntimer(120000, 1000) { public void ontick(long millisuntilfinished) { sharedpreferences pref = getactivity().getsharedpreferences("data", context.mode_private); sharedpreferences.editor editor = pref.edit(); editor.putstring("click"+judul, "1"); } public void onfinish() { sharedpreferences pref = getactivity().getsharedpreferences("data", context.mode_private); sharedpreferences.editor editor = pref.edit(); editor.putstring("click"+judul, "0"); } }.start(); }
can use method ontick , onfinish change preference ?? want make session timeout in android actually. im using countdown timer manipulate it.
use more easy
sharedpreferences pref = getactivity().getsharedpreferences("data", context.mode_private); pref.edit().putstring("click"+judul, "1").commit();
Comments
Post a Comment