Android: How to detect if users if within distance of GeoPoint on MapVIew
I have an application with a map and an ItemizedOverlay
, and need to determine if t开发者_JS百科he user is within a certain distance of a GeoPoint
on the ItemizedOverlay
. If thats the case then start a new Activity
..
How do I approach this?
It sounds like you have various things you need to do, I would break it down into the following
- Obtain the users GeoPoint, have a look at this API it might be useful
- Determine the distance between the users GeoPoint and any other given GeoPoint, I found this article which explains how to calculate distances, its worth a read
- If the distance meets a particular requirement, then start a new activity, for this I would suggest to read up on Intents/Lifecycle. You could create a new intent and use
startActivity(intent);
which would start another activity, you can read more here
精彩评论