mangstadt / biweekly

biweekly is an iCalendar library written in Java.
BSD 2-Clause "Simplified" License
323 stars 44 forks source link

Question: how to use RecurrenceRuleScribe scribe = new RecurrenceRuleScribe(); #65

Closed Kashif2016 closed 7 years ago

Kashif2016 commented 7 years ago

@mangstadt thankyou for this library. I am new to android so sorry if my question is really basic. i am trying to use your library to parse RRULE of my ics file, so i looked into FAQ and Wiki, how to use RecurrenceRuleScribe scribe = new RecurrenceRuleScribe(); but when i add this in my code in "mainClass" i get an error

Caused by: java.lang.NoClassDefFoundError: com.github.mangstadt.vinnie.SyntaxStyle
 at biweekly.ICalVersion.<clinit>(ICalVersion.java:39)
 at biweekly.io.scribe.property.ICalPropertyScribe.<clinit>(ICalPropertyScribe.java:75)

i have already added biweekly-0.6.0.jar in libs and imports in "main class".

import biweekly.io.scribe.property.RecurrenceRuleScribe;
import biweekly.parameter.ICalParameters;
import biweekly.property.DateEnd;
import biweekly.property.DateStart;
import biweekly.property.DateTimeStamp;
import biweekly.property.RecurrenceRule;

i have already get the Start Date , End Date and RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13 just need to parse this RRULE to get all the events .... It would be really appreciated If you could please guide me how i can parse this RRULE

mangstadt commented 7 years ago

You must also have the "vinnie" library on your classpath.

You can get the vinnie library by going to the Downloads page and clicking on the "JAR with Dependencies" link.

Kashif2016 commented 7 years ago

Thank you for your quick reply , i'll check that..

Kashif2016 commented 7 years ago

Thank you very much it is working now.

how can i pass it my start date , end date and RRULE to get all the events?

mangstadt commented 7 years ago
Recurrence recur = ...
Date start = ...
TimeZone yourTimeZone = ...
RecurrenceRule rrule = new RecurrenceRule(recur);
DateIterator it = rrule.getDateIterator(start, yourTimeZone);
Kashif2016 commented 7 years ago

thank you ill try it

Kashif2016 commented 7 years ago

I have tried a lot but app get crashed on first line

Recurrence recur = new Recurrence.Builder(Frequency.valueOf(component.getProperty("RRULE").getValue())).build();
Date start = checkStartDate;
TimeZone TZ = TimeZone.getDefault();
RecurrenceRule rrule = new RecurrenceRule(recur);
DateIterator it = rrule.getDateIterator(start,TZ);

P.S component.getProperty("RRULE").getValue() =>RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13

Kashif2016 commented 7 years ago

i have found a solution in one of your closed issue #47 now i am able to display all the recurring events. Thanks for the library