当我试图停止我的 gsp 侦听器时,我被强制关闭
这是代码:
mlocManager.removeUpdates(mlocListener);
mlocManager = null;
还有这个:
LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener mlocListener = new MyLocationListener();
mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
(long) update, 0, mlocListener);
请帮助我,我不明白为什么它会强制关闭。
07-30 11:43:39.557: D/AndroidRuntime(1071): Shutting down VM
07-30 11:43:39.557: W/dalvikvm(1071): threadid=1: thread exiting with uncaught exception (group=0x40015560)
07-30 11:43:39.575: E/AndroidRuntime(1071): FATAL EXCEPTION: main
07-30 11:43:39.575: E/AndroidRuntime(1071): java.lang.NullPointerException
07-30 11:43:39.575: E/AndroidRuntime(1071): at com.example.anotheractivity.Festivale$1.onClick(Festivale.java:109)
07-30 11:43:39.575: E/AndroidRuntime(1071): at android.view.View.performClick(View.java:2485)
07-30 11:43:39.575: E/AndroidRuntime(1071): at android.view.View$PerformClick.run(View.java:9080)
07-30 11:43:39.575: E/AndroidRuntime(1071): at android.os.Handler.handleCallback(Handler.java:587)
07-30 11:43:39.575: E/AndroidRuntime(1071): at android.os.Handler.dispatchMessage(Handler.java:92)
07-30 11:43:39.575: E/AndroidRuntime(1071): at android.os.Looper.loop(Looper.java:123)
07-30 11:43:39.575: E/AndroidRuntime(1071): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-30 11:43:39.575: E/AndroidRuntime(1071): at java.lang.reflect.Method.invokeNative(Native Method)
07-30 11:43:39.575: E/AndroidRuntime(1071): at java.lang.reflect.Method.invoke(Method.java:507)
07-30 11:43:39.575: E/AndroidRuntime(1071): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-30 11:43:39.575: E/AndroidRuntime(1071): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-30 11:43:39.575: E/AndroidRuntime(1071): at dalvik.system.NativeStart.main(Native Method)
07-30 11:43:41.565: I/Process(1071): Sending signal. PID: 1071 SIG: 9