How are you getting that Location that is null?

On Thu, Jul 7, 2011 at 8:18 AM, Raghav Sood <raghavs...@gmail.com> wrote:
> Hi all
> I wrote an app that gets and displays your location on a map. I am using the
> Google Maps service to render the map. The app has been live for less than
> two hours and I have received 33 crash reports (using ACRA).
> I have been able to recreate the problem. The app works fine if the GPS is
> off but if it is switched on the app force closes.
> The stack trace reads:
> java.lang.NullPointerException
> at com.raghavsood.findme.MyPositionOverlay.draw(MyPositionOverlay.java:37)
> at com.google.android.maps.Overlay.draw(Overlay.java:179)
> at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:45)
> at com.google.android.maps.MapView.onDraw(MapView.java:494)
> at android.view.View.draw(View.java:6818)
> at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
> at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
> at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
> at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
> at android.view.View.draw(View.java:6821)
> at android.widget.FrameLayout.draw(FrameLayout.java:354)
> at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
> at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
> at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
> at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
> at android.view.View.draw(View.java:6821)
> at android.widget.FrameLayout.draw(FrameLayout.java:354)
> at
> com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1944)
> at android.view.ViewRoot.draw(ViewRoot.java:1432)
> at android.view.ViewRoot.performTraversals(ViewRoot.java:1174)
> at android.view.ViewRoot.handleMessage(ViewRoot.java:1752)
> at android.os.Handler.dispatchMessage(Handler.java:99)
> at android.os.Looper.loop(Looper.java:123)
> at android.app.ActivityThread.main(ActivityThread.java:4632)
> at java.lang.reflect.Method.invokeNative(Native Method)
> at java.lang.reflect.Method.invoke(Method.java:521)
> at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
> at dalvik.system.NativeStart.main(Native Method)
> I don't know why there is a NullPointerException exception at
> MyPositionOverlay on line 37. The line in question reads:
>
> Double latitude = location.getLatitude()*1E6;
>
> The same code works fine if GPS is off.
>
> The app is https://market.android.com/details?id=com.raghavsood.findme
> Does anyone know what could be causing this and how to fix it?
> Thanks
> --
> Raghav Sood
> http://www.raghavsood.com/
> http://www.androidappcheck.com/
> http://www.telstop.tel/
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to