Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to interpret Debugging information?
    primarykey
    data
    text
    <p>This is actually two questions. The first relates to my program, and the second is a more general question regarding debugging.</p> <p>In my code, I have two button listeners. When the first is clicked, the onClickListener creates the locationlistener, as well as the LocationManager which requests updates from the locationlistener. (See below...) </p> <pre><code>LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationlistener); </code></pre> <p>On the click of the second button, I try to unregister the listener as follows... </p> <p>locationManager.removeUpdates(locationlistener);</p> <p>However, I end up with a force close and the following info in the debugger...</p> <pre><code>ERROR/AndroidRuntime(310): FATAL EXCEPTION: main ERROR/AndroidRuntime(310): java.lang.NullPointerException ERROR/AndroidRuntime(310): at com.ryan.gcal.GRunCal$2.onClick(GRunCal.java:94) ERROR/AndroidRuntime(310): at android.view.View.performClick(View.java:2408) ERROR/AndroidRuntime(310): at android.view.View$PerformClick.run(View.java:8816) ERROR/AndroidRuntime(310): at android.os.Handler.handleCallback(Handler.java:587) ERROR/AndroidRuntime(310): at android.os.Handler.dispatchMessage(Handler.java:92) ERROR/AndroidRuntime(310): at android.os.Looper.loop(Looper.java:123) ERROR/AndroidRuntime(310): at android.app.ActivityThread.main(ActivityThread.java:4627) ERROR/AndroidRuntime(310): at java.lang.reflect.Method.invokeNative(Native Method) ERROR/AndroidRuntime(310): at java.lang.reflect.Method.invoke(Method.java:521) ERROR/AndroidRuntime(310): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) ERROR/AndroidRuntime(310): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) ERROR/AndroidRuntime(310): at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>Line 94 of my code, where the error originates, is where I tried to remove the location listener. So I assume I am not removing the location listener properly, but I am not sure what is wrong. My LocationManager is declared at the start of my code...</p> <pre><code>Locationmanager locationManager; </code></pre> <p>My first question is, what am I doing wrong in removing the listener? And secondly, can anyone provide some tips/advice on learning to interpret debug errors meaningfully? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload