google-api-java-client for Google Calendar on Android Infinite loop

前端 未结 1 1965
滥情空心
滥情空心 2021-01-27 11:11

I have been struggling with the sample android application provided by Google for integrating some Google calendar functionality found here at Google code.

I\'ve modifie

相关标签:
1条回答
  • 2021-01-27 11:41

    I was going to remove this post after realizing my sheer stupidity, but I'm going to leave it up for others who fall hard like me.

    The infinite loop was being created because nextLink never became null when I had more than 25 events in my calendar. I'm guessing that without setting a value for maxResults, the default is 25. Hence, when I had more than 25 events in my calendar, a "null" nextLink could never exist because the Atom returned has exactly 25 events.

    If I set maxResults to 50 and only 49 events exist in my calendar, the 50th nextLink would be null thus triggering the break from the loop.

    I have just set maxResults to a huge number like 1,000,000. I figure if a person has 10 events in their calendar every day and lives to be 80 years old, that would only equate to around 291,000 events. I figure 1,000,000 is a safe number.

    0 讨论(0)
提交回复
热议问题