如何使用Samsung Health SDK每小时获取一天的数据?

时间:2018-06-26 18:18:24

标签: android android-studio

  

只有步数计数。在c.getInt(c.getColumnIndex(HealthConstants.StepCount.COUNT))行中;但是我想要特定日期的小时数据。

private final HealthResultHolder.ResultListener<ReadResult> mListener = new HealthResultHolder.ResultListener<ReadResult>() {
    @Override
    public void onResult(ReadResult result) {
        int count = 0;
        Cursor c = null;

        try {
            c = result.getResultCursor();
            if (c != null) {
                while (c.moveToNext()) {
                    count += c.getInt(c.getColumnIndex(HealthConstants.StepCount.COUNT));
                }
            }
        } finally {
            if (c != null) {
                c.close();
            }
        }
        MainActivity.getInstance().drawStepCount(String.valueOf(count));
    }
};

0 个答案:

没有答案