On Wed, Oct 10, 2012 at 4:50 PM, Nicholas Campion <[email protected]> wrote:
> Obviously, Android apps sometimes don't know their location
> (lastKnownLocation returns null, etc.). Internally, we deal with this by
> checking if the app wide Location object is null and substituting -999 for
> latitude and longitude ... something that is obviously invalid so we can
> quickly spot it.
>
> I'm wondering what other people do in this area. I looked at creating a Null
> Object Location but got kinda worried by the two constructors for Locations
> that I might be barking up the wrong tree. Anyone have ideas on how to deal
> with creating a substitute location when the OS won't provide one?
>

I would say, by the contrary, you probably want to do something that
is *not* a sentinel value (such as -999).

Instead what you want is something along the lines of a "Maybe monad."

kris

-- 
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

Reply via email to