次のコード
では、t.schedule(timertask, d.getDate(), 1000); NullPointer例外をスロー
しています
助けてください
目標:
私の基本的な目標は、AndroidデバイスからWebサービスにデータを送信するメソッドを(一定の間隔で毎回)実行することです
Date d = new Date();
d.getDate();
timertask = new TimerTask() {
@Override
public void run() {
new Thread() {
public void run() {
try {
ProDialog = ProgressDialog.show(Home.this,
"Sending Data",
"Please wait while sending data...");
Looper.prepare();
sendLocation();
handler.sendEmptyMessage(0);
quit();
Looper.loop();
} catch (Exception e) {
ProDialog.dismiss();
}
}
public void quit() {
ProDialog.dismiss();
Looper.myLooper().quit();
}
}.start();
}
};
try {
t.schedule(timertask, d.getDate(), 1000);
} catch (Exception e) {
e.printStackTrace();
}