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

半世苍凉 提交于 2019-12-02 07:53:51

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!