Skip to content

Instantly share code, notes, and snippets.

@mtrung
Created July 2, 2015 22:42
Show Gist options
  • Save mtrung/6d25cbdf6fefe7633936 to your computer and use it in GitHub Desktop.
Save mtrung/6d25cbdf6fefe7633936 to your computer and use it in GitHub Desktop.
dumpDataset from Google Fit
void dumpDataset(DataSet dataSet) {
if (dataSet.isEmpty()) return;
SimpleDateFormat dateFormat = new SimpleDateFormat();
for (DataPoint dp : dataSet.getDataPoints()) {
String s = String.format("Data point: %s -> %s %s",
dp.getDataType().getName(),
dateFormat.format(dp.getStartTime(TimeUnit.MILLISECONDS)),
dateFormat.format(dp.getEndTime(TimeUnit.MILLISECONDS)));
Log.i(TAG, s);
for(Field field : dp.getDataType().getFields()) {
Log.i(TAG, "\t" + field.getName() + " = " + dp.getValue(field));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment