【问题标题】:Error while getting GPS pos and parsing XML获取 GPS 位置和解析 XML 时出错
【发布时间】:2011-12-12 18:04:13
【问题描述】:

谁能解释导致此错误的原因:

我正在使用 DOM 来解析 XML。

12-12 08:56:52.053: 错误/AndroidRuntime(289): java.lang.NullPointerException 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 gps.app.tkartor.Tkartor.onLocationChanged(Tkartor.java:205) 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:191) 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:124) 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:140) 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 android.os.Handler.dispatchMessage(Handler.java:99) 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 android.os.Looper.loop(Looper.java:123) 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 android.app.ActivityThread.main(ActivityThread.java:4627) 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 java.lang.reflect.Method.invokeNative(Native Method) 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 java.lang.reflect.Method.invoke(Method.java:521) 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 12-12 08:56:52.053: 错误/AndroidRuntime(289): 在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 12-12 08:56:52.053: 错误/AndroidRuntime(289): at dalvik.system.NativeStart.main(Native Method)

【问题讨论】:

  • GPS监听器中的解析器有什么用?请张贴代码。
  • 我只想知道是什么导致了错误,而不是如何解决它。我想自己弄清楚。

标签: android xml gps


【解决方案1】:

我认为您应该检查onLocationChanged 中收到的位置中的空字段。当没有 GPS 覆盖时,会接收到虚拟位置对象。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多