• Post Reply Bookmark Topic Watch Topic
  • New Topic

Practical Use for Calendar roll() method?  RSS feed

 
Ranch Hand
Posts: 81
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying out Calendar methods, most useful to me seems to be the add() method. If I want to linearly plot an event , e.g. a coffee dripolator or a medicated saline infusion into a patient every delta, the increment to be in delta seconds interval in a do-while loop, then this is what I would do.



QUESTION: How would I use roll()? Can you please give me a practical example as per above?

I was playing with my Android and the only practical use seems to be rolling from 12/10/2015 to 1/10/2016 when I swipe the calendar app screen.
 
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AhFai Chan wrote:QUESTION: How would I use roll()? Can you please give me a practical example as per above?

As I recall, roll() does not take normal calendar rules into account (unllike add()), so you can use it to, for example update a Calendar to send out a bill on the 25th of NEXT month, without having to worry about how many days the month has, or whether it's a leap year etc.

29th of next month might be a problem though.

HIH

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!