2011-07-07 8 views
0

私は、アプリケーション内に保存された返却日(近くのどこかに)を持っています。androidで正確にカウントダウンタイマーを使用する方法

今、私はアンドロイド携帯電話の現在の時間を見つける必要があり、その後、カウントダウンまでの分の時間を見つけることができます。以下、私が合格し、以下のオブジェクトを作成するとき、これが正しく動作しませんPinnedCountdownTimer pct = new PinnedCountdownTimer((getTimeToReturn().getTime()-System.currentTimeMillis()),1000,countdownTv);

public class PinnedCountdownTimer extends CountDownTimer { 

TextView tv; 
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); 
Date resultdate ; 
public PinnedCountdownTimer(long millisInFuture, long countDownInterval,TextView tv) { 
    super(millisInFuture, countDownInterval); 
    this.tv = tv; 
} 

@Override 
public void onFinish() { 
    tv.setText("get back to your car!"); 
} 

@Override 
public void onTick(long millisUntilFinished) { 
    resultdate = new Date(millisUntilFinished); 
    tv.setText("Left: " + sdf.format(resultdate)); 
} 

}

、私は現時点で持っているものです.....あなたたちはどんな考えを持っていますか?

答えて

0

documentationによると、私が読んでいるものからpct.start()を呼び出す必要があります。それ以外の場合、私はAndroidの開発者ではありませんが、普通のJavaの中にあるTimerクラスもあり、Androidでも利用できるように見えます。

関連する問題