Right. Got it now. Basically I need to check location for null twice. Once in the Activity and once in the Overlay.
Thanks On Thu, Jul 7, 2011 at 11:44 PM, TreKing <[email protected]> wrote: > On Thu, Jul 7, 2011 at 1:00 PM, Raghav Sood <[email protected]> wrote: > >> But the thing is location can't be null. > > > It can and it is. > > >> If it was the app wouldn't have reached here. > > > Correct. But this is not where the crash is. > > >> I check for location being null in my main activity: >> >> if (location != null) { >> >> // Update my location marker >> >> positionOverlay.setLocation(location); >> >> >> Only the does MyPositionOverlay receive location. >> > > Precisely - only there does it receive location - otherwise it remains null > (the default for an object) and you don't check for null in your draw() > call. Thus, unless you set a valid Location object in your main activity, > your internal location will remain null and you will crash and burn as you > have already seen when your position overlay goes to draw. > > > ------------------------------------------------------------------------------------------------- > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago > transit tracking app for Android-powered devices > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Raghav Sood http://www.raghavsood.com/ http://wiki.androidappcheck.com/ http://www.telstop.tel/ https://market.android.com/developer?pub=Raghav+Sood -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

