Skip to content Skip to sidebar Skip to footer

Fatal Exception: Timer-0 Java.lang.nullpointerexception

I'm having a timer in the oncreate() like: final Timer timer1 = new Timer(); timer1.schedule(new TimerTask() { public void run() { sendSMS(); } }, 20000); The meth

Solution 1:

I set reallocation as Location: Location reallocation=null; – user1404924 3 mins ago

you set reallocation =null. you can not invoke reallocation's method reallocation.getAccuracy(); because you dont have a instance of the obj yet.

I suggest you to take a look at LocationManager class. You can request location from there with a specific location source http://developer.android.com/reference/android/location/LocationManager.html

Solution 2:

reallocation is uninitialized, so its taking the null value, the default one for object.

Post a Comment for "Fatal Exception: Timer-0 Java.lang.nullpointerexception"