Problem with SMS scheduling(Android)
I have designed for schedule SMS in android.i set timer for SMS to send by using CountDownTimer
Constructor class. values for timer assigned,but i cannot start the countdown time even i have passed the timer value and interval values. If i start the constructor manually by using object, the sms is sent immediately(not waiting for the time set). I need to send the sms when the time set to send is reached .Here goes my code. Any Help is Appreciated.
new Mycounter(dif, 1000);
// My Counter timer code goes here
publ开发者_开发知识库ic class Mycounter extends CountDownTimer
{
String phoneNo = txtPhoneNo.getText().toString();
String message = txtMessage.getText().toString();
public Mycounter(long millisInFuture, long countDownInterval)
{
super(millisInFuture, countDownInterval);
// TODO Auto-generated constructor stub
}
@Override
public void onFinish() {
sendSMS(phoneNo, message);
// TODO Auto-generated method stub
}
@Override
public void onTick(long millisUntilFinished)
{
// TODO Auto-generated method stub
}
}
Are you calling start()?
new Mycounter(dif, 1000).start()
Otherwise your timer code looks good.
Add few logs.
精彩评论