Anna PS wrote:
> Sorry, I guess I'm being dim. Should I add some code inside the
> onLocationChanged method itself to check the accuracy? And then just
> check this number when the user clicks on the button?
>
> public void onLocationChanged(Location location) {
> accuracy = location.getAccuracy();
> }
Possibly. I was more thinking that if the user presses the button, and
an immediate getLastKnownLocation() returns null or an
insufficiently-accurate value, you then start paying attention to the
location you get with onLocationChanged().
If getLastKnownLocation() was null, the first fix you get should be
treated as if it came from your getLastKnownLocation(), and checked for
accuracy.
If you are waiting for more accurate values, using onLocationChanged()
will be the fastest way to get them, and it gets rid of your background
thread.
So, set yourself a flag indicating your current state, check that flag
in onLocationChanged(), and take appropriate action -- probably the same
action you were doing in the background thread, just pulled into
onLocationChanged().
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
_Android Programming Tutorials_ Version 1.0 Available!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---