In the following code
t.schedule(timertask, d.getDate(), 1000); is throwing
NullPointer exception
help me out
Goal :
My basic goal is to Run a method(every time after a fixed interval ) that will send some data to webservice from my android device
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();
}