它,我有一個類繼承countdowntimer使土司的活動,並表示其他的一個
我想在onfinish()敬酒,每次最多顯示從其它類稱爲onfinish()函數在從它實例化的任何對象中
我該怎麼做?
package com.fawzyx.exams_countdowntimer;
import android.os.CountDownTimer;
import android.text.InputFilter.LengthFilter;
import android.widget.Toast;
public class CountDown extends CountDownTimer {
public CountDown(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
/*
millisInFuture : The number of millis in the future from the call to start() until the countdown is done and onFinish() is called.
countDownInterval : The interval along the way to receive onTick(long) callbacks.
*/
}
@Override
public void onFinish() {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext() ,"Done", Toast.LENGTH_LONG);
}
@Override
public void onTick(long millisUntilFinished) {
// TODO Auto-generated method stub
}
}
使用getApplicationContext(),而不是特定的上下文 –
傳遞活動場景到類的構造函數,並用它那裏顯示敬酒 – Raghunandan
它給了我錯誤 – Fawzinov