简体   繁体   中英

Get the user's GPS location and store it

It want to keep an array (Java generics for example: List) of the last 10 coordinates in order of retrieval so latest coordinates are always at the top of the stack etc. If I ask for this array we can then go back to see what steps the user took by tracing there steps.Please help me here. Thanks

First you need to read about how to retrive the user GPS location.

http://www.vogella.com/articles/AndroidLocationAPI/article.html

Then make your class implement android.location.LocationListener and in the onLocationChanged() callback just add the location to the list.

@Override
public void onLocationChanged(Location location) {
   list.add(location);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM