estoyEstoy intentando obtener la ubicación con mapsforge 0.6.1, pero en el método onCreate()onCreate()
al asignar latitud y longitud me aparece este error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.luis.safe, PID: 27378
java.lang.RuntimeException: Unable to create service com.example.luis.safe.Tracker: java.lang.NullPointerException: Attempt to invoke virtual method 'double org.mapsforge.core.model.LatLong.getLatitude()' on a null object reference
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2905)
at android.app.ActivityThread.access$1900(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1439)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5530)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'double org.mapsforge.core.model.LatLong.getLatitude()' on a null object reference
at com.example.luis.safe.Tracker.onCreate(Tracker.java:57)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2895)
at android.app.ActivityThread.access$1900(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1439)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5530)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.luis.safe, PID: 27378 java.lang.RuntimeException: Unable to create service com.example.luis.safe.Tracker: java.lang.NullPointerException: Attempt to invoke virtual method 'double org.mapsforge.core.model.LatLong.getLatitude()' on a null object reference at android.app.ActivityThread.handleCreateService(ActivityThread.java:2905) at android.app.ActivityThread.access$1900(ActivityThread.java:157) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1439) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5530) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'double org.mapsforge.core.model.LatLong.getLatitude()' on a null object reference at com.example.luis.safe.Tracker.onCreate(Tracker.java:57) at android.app.ActivityThread.handleCreateService(ActivityThread.java:2895) at android.app.ActivityThread.access$1900(ActivityThread.java:157) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1439) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5530) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)