我試圖環舉杯定時器內,但敬酒不顯示looper.prepare問題
在日誌中logcat的節目不能內螺紋創建處理程序尚未調用looper.prepare()我是不知道這意味着什麼
int initialDelay = 10000;
int period = 10000;
final Context context = getApplicationContext();
TimerTask task = new TimerTask()
{
public void run()
{
try
{
if (a != "")
{
Toast toast = Toast.makeText(context, "Alert Deleted!", Toast.LENGTH_SHORT);
toast.show();
}
}
catch (Exception e)
{
}
}
};
timer.scheduleAtFixedRate(task, initialDelay, period);
什麼我的應用程序是,每10秒它會檢查,如果某個變量是空的。如果它是空的,那麼它會顯示一個敬酒。
我沒有問題,在服務類這樣做,但是當我嘗試落實到
public void onCreate(Bundle savedInstanceState)
這個我得到這個錯誤