Monday, November 15, 2010

Sample of FVM code

For those of you interested in how the code looks in the FVM app, here is a sample, as it appears in the IDE:

This snippet is called every time the GPS gives the app a new set of coordinates ...

public void onLocationChanged(Location currentLoc)

// This grabs the location data from an external file.
locations = res.getTextArray(R.array.locations);

// This loop goes through each location in that file...
for (int i = 0; i < locations.length; i++) {
String[] loc_data;
loc_data = locations[i].toString().split("%%");

Location landmark = new Location(currentLoc);

// ... and then loads up the lat/lon

// ... and checks to see if that is within 5 meters of where we are standing.
if (currentLoc.distanceTo(landmark) < 5) {
// ... code to handle launching videos, slideshows, etc. goes in here
// but has been snipped out for brevity.


No comments:

Post a Comment