0
開始値を変更するにはスタートカウントタイマー方式を使用したいが、それは機能しません。countdowntimerを使用したセッションタイムアウトの共有設定
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();
}
私は、そのような設定を変更するためにontickとonfinishメソッドを使用できますか?私は実際にアンドロイドでセッションタイムアウトを作りたいと思っています。だから私はそれを操作するカウントダウンタイマーを使用しています。このような
より簡単です。あなたはeditor.commit()を使用しなければなりません –
aw愚かな私 - _-ありがとう –