In the following code
t.schedule (timertask, d.getDate (), 1000); throws NullPointer exception help me
Goal:
My main goal is to execute 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(); }
user1448729
source share