]> iEval git - unical.git/commitdiff
Add function to return all events from calendar
authorPetru Trimbitas <l3asketballplayer@yahoo.com>
Sun, 9 Jun 2013 08:18:37 +0000 (11:18 +0300)
committerPetru Trimbitas <l3asketballplayer@yahoo.com>
Sun, 9 Jun 2013 08:18:37 +0000 (11:18 +0300)
src/ro/ieval/unical/Event.java

index af41133cda1098a1a0c4f1a97214c0f2160401f3..8482e31d128e7f6b87635dc831b9778a4518ef20 100644 (file)
@@ -1,5 +1,7 @@
 package ro.ieval.unical;
 
+import java.util.ArrayList;
+
 import android.content.ContentResolver;
 import android.content.Context;
 import android.database.Cursor;
@@ -79,6 +81,17 @@ final class Event implements Parcelable{
                }
                return events;
        }
+       
+       public static Event[] getAllEvents(final Context context) {
+               Calendar[] calendars = Calendar.getAllCalendars(context);
+               ArrayList<Event> r = new ArrayList<Event>();
+               for(int i=0; i<calendars.length; ++i) {
+                       Event[] e=getEventsByCalendar(context, calendars[i]._id, "");
+                       for(int j=0; j<e.length; ++j)
+                               r.add(e[j]);
+               }
+               return  r.toArray(new Event[r.size()]);
+       }
 
        public void delete(final Context context){
                final ContentResolver cr=context.getContentResolver();
This page took 0.02446 seconds and 4 git commands to generate.