I am trying to put items on a calendar and cannot figure out how to encode it. This is what I still have, but it inserts it into the main calendar.
String calName; String calId = null; String[] projection = new String[] { "_id", "name" }; Uri calendars = Uri.parse("content://calendar/calendars"); Cursor managedCursor = managedQuery(calendars, projection, null, null, null); ContentValues event = new ContentValues(); event.put("calendar_id", calId); event.put("title", strTitle); event.put("description", strDescription); event.put("eventLocation", strLocation); event.put("dtstart", StartTime); event.put("dtend", EndTime); Uri eventsUri = Uri.parse("content://calendar/events"); Uri calUri = getContentResolver().insert(eventsUri, event);
So my questions are:
How to create your own calendar to post events in
How to insert my events into this calendar (using the code above or a new code)
How to check if an existing event already exists
~~~ UPDATE: ~~~
What I'm trying to do is that my users will enter the title and date, and my application will take that title and date, put them in the database (for now, all I have done), and now I want to take the title and date and put them in a special calendar dedicated only to my applications. The first thing I need to do is create a new calendar. How to embed events in this calendar, which helps me make the code below. Still playing with him. Than I want to restart my application and check if the event exists. That's all.
source share