public ArrayList<Location> getLocations() { ArrayList<Location> locations = new ArrayList<Location>(); for (SKLocationData locationData : currentLocationArrayList) { locations.add(locationData.getLocation()); } return locations; }
// Stop Sensing the location and close SensingKit public Location stopSensing() { SKLocationData lastData = null; try { if (mSensingKitLib.isSensorSensing(SKSensorType.LOCATION)) { mSensingKitLib.stopContinuousSensingWithSensor(SKSensorType.LOCATION); } if (currentLocationArrayList.size() > 0) { // avoid null pointer exception lastData = currentLocationArrayList.get(currentLocationArrayList.size() - 1); System.out.println( "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); // print out the last // data System.out.println("The last data : " + lastData.getDataInCSV()); System.out.println("The size of data list : " + currentLocationArrayList.size()); System.out.println(">>Latitude : " + lastData.getLocation().getLatitude()); System.out.println(">>Longitude : " + lastData.getLocation().getLongitude()); return lastData.getLocation(); } } catch (SKException e) { e.printStackTrace(); } return null; }