Partial retrieval of results from the Google Health API

83 Views Asked by At

I want to get records from Google Health within a range. Every time I send a new query, I want to get ten records.

I.e. Start: 1 to 10
Second query: start 11 to 20
....

I used the following query :

 PROFILE_URL + selectedProfileId
     + "/-/labtest?start-index="+index+"&max-results=10";

This retrieved records, but when it reached the end where the list had only five records and it queries for ten results, the application crashes.

How can I get the total count of results, or partial results?

1

There are 1 best solutions below

0
On

One can use the above query and it will return records as many as it has even if it has records less than max-results. But this will throw exception when try to query for the invalid count. So catch the exception there where u add the values into your listView.