嗨,我每次运行我的应用程序时都会强制关闭..它允许出现启动画面,但是一旦我点击“查找我的位置”按钮,它就会强制关闭....我发现奇怪的是当我的 gps 关闭时,wi-fi 可以正常工作。我已经检查以确保我在清单中也有正确的权限。我已经附上了logcat。我是否正确地假设错误出现在第 23 行的 MyLocOverlay 类中?有人可以为我指出正确的方向来解决这个问题吗?谢谢
public class MyLocOverlay extends Overlay {
private final int Radius = 5;
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
Projection projection = mapView.getProjection();
if (shadow == false) {
// line below is line 23
Double lat = location.getLatitude()*1E6;
Double lng = location.getLongitude()*1E6;
GeoPoint geoPoint; geoPoint = new GeoPoint(lat.intValue(),lng.intValue());
}
}
}
日志猫
04-14 02:41:30.332: INFO/ActivityManager(102): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.irwine.touristapplication/.SplashScreen }
04-14 02:41:30.502: INFO/ActivityManager(102): Start proc com.irwine.touristapplication for activity com.irwine.touristapplication/.SplashScreen: pid=13759 uid=10060 gids={3003}
04-14 02:41:31.012: WARN/Rosie(5927): mAddHtcWidgetByOtherActivity = false, mIsOpenSlideWhenLeaveLaunch = true
04-14 02:41:31.012: WARN/InputManagerService(102): Ignoring hideSoftInput of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44b033b8
04-14 02:41:31.132: WARN/InputManagerService(102): Got RemoteException sending setActive(false) notification to pid 13731 uid 10060
04-14 02:41:31.322: INFO/ActivityManager(102): Displayed activity com.irwine.touristapplication/.SplashScreen: 834 ms (total 33041 ms)
04-14 02:41:36.152: INFO/ActivityManager(102): Starting activity: Intent { cmp=com.irwine.touristapplication/.mainmenu }
04-14 02:41:36.542: INFO/ActivityManager(102): Displayed activity com.irwine.touristapplication/.mainmenu: 337 ms (total 337 ms)
04-14 02:41:40.152: INFO/ActivityManager(102): Starting activity: Intent { cmp=com.irwine.touristapplication/.gps }
04-14 02:41:42.502: INFO/MapActivity(13759): Handling network change notification:CONNECTED
04-14 02:41:42.502: ERROR/MapActivity(13759): Couldn't get connection factory client
04-14 02:41:42.752: WARN/dalvikvm(13759): threadid=1: thread exiting with uncaught exception (group=0x40028a00)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): FATAL EXCEPTION: main
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): java.lang.NullPointerException
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at com.irwine.touristapplication.MyLocOverlay.draw(MyLocOverlay.java:23)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at com.google.android.maps.Overlay.draw(Overlay.java:179)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:45)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at com.google.android.maps.MapView.onDraw(MapView.java:494)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.View.draw(View.java:6739)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.View.draw(View.java:6742)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.widget.FrameLayout.draw(FrameLayout.java:352)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.View.draw(View.java:6742)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.widget.FrameLayout.draw(FrameLayout.java:352)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1872)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewRoot.draw(ViewRoot.java:1422)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewRoot.performTraversals(ViewRoot.java:1167)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.os.Handler.dispatchMessage(Handler.java:99)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.os.Looper.loop(Looper.java:143)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at android.app.ActivityThread.main(ActivityThread.java:4914)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at java.lang.reflect.Method.invokeNative(Native Method)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at java.lang.reflect.Method.invoke(Method.java:521)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-14 02:41:42.782: ERROR/AndroidRuntime(13759): at dalvik.system.NativeStart.main(Native Method)
04-14 02:41:42.802: WARN/ActivityManager(102): Force finishing activity com.irwine.touristapplication/.gps
04-14 02:41:42.812: WARN/ActivityManager(102): Force finishing activity com.irwine.touristapplication/.mainmenu
04-14
02:41:43.316: WARN/ActivityManager(102): Activity pause timeout for HistoryRecord{44eb0130 com.irwine.touristapplication/.gps}
04-14 02:41:44.742: INFO/Process(13759): Sending signal. PID: 13759 SIG: 9
04-14 02:41:44.752: INFO/WindowManager(102): WIN DEATH: Window{44b42110 com.irwine.touristapplication/com.irwine.touristapplication.mainmenu paused=true}
04-14 02:41:44.762: INFO/ActivityManager(102): Process com.irwine.touristapplication (pid 13759) has died.
04-14 02:41:44.772: INFO/WindowManager(102): WIN DEATH: Window{44b66298 com.irwine.touristapplication/com.irwine.touristapplication.gps paused=false}
04-14 02:41:53.654: WARN/ActivityManager(102): Activity destroy timeout for HistoryRecord{44bd91e8 com.irwine.touristapplication/.mainmenu}
04-14 02:41:53.699: WARN/ActivityManager(102): Activity destroy timeout for HistoryRecord{44eb0130 com.irwine.touristapplication/.gps}