短信调度问题(Android)

时间:2011-08-03 12:17:08

标签: java android sms

我已经设计了安排SMS的android.i设置定时器,用于通过CountDownTimer Constructor类发送SMS。分配的定时器的值,但即使我已经通过了定时器值和间隔值,我也无法启动倒计时时间。如果我通过使用对象手动启动构造函数,则会立即发送短信(不等待设置的时间)。我需要在达到发送时间时发送短信。这是我的代码。感谢任何帮助。

new Mycounter(dif, 1000);


// My  Counter timer code goes here

 public 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

       }
      }

1 个答案:

答案 0 :(得分:0)

你打电话给start()吗? new Mycounter(dif,1000).start()

否则您的计时器代码看起来不错 添加几个日志。

相关问题