Skip to content

Instantly share code, notes, and snippets.

@Casperhr
Created June 11, 2014 21:20
Show Gist options
  • Select an option

  • Save Casperhr/85c1f9c50f6507eb0bbd to your computer and use it in GitHub Desktop.

Select an option

Save Casperhr/85c1f9c50f6507eb0bbd to your computer and use it in GitHub Desktop.
NJSONObject records = json.optNJSONObject("Records");
//Check if null
NJSONObject record = records.getNJSONObject("Record");
//Check if null
NJSONObject tracking = record.optNJSONObject("Tracking");
//Check if null
String gpsPosition = tracking.optString("GPSPosition",null);
if(gpsPosition != null){
String[] gpsPositionArray = gpsPosition.split(",");
double lat = Double.parseDouble(gpsPositionArray[0]);
double lng = Double.parseDouble(gpsPositionArray[1]);
//Save a latlng object on user
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment