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

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -