Created
May 6, 2016 06:41
-
-
Save burakiren/aa1316be642b79c1fb7ce29a11656f12 to your computer and use it in GitHub Desktop.
Adding events to calendar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Calendar cal = Calendar.getInstance(); | |
try { | |
cal.setTime(new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss").parse("07052016")); | |
} catch (ParseException e) { | |
System.out.println("Parse Exception"); | |
} | |
Intent intent = new Intent(Intent.ACTION_EDIT); | |
intent.setType("vnd.android.cursor.item/event"); | |
intent.putExtra("beginTime", cal.getTimeInMillis()); | |
intent.putExtra("allDay", false); | |
intent.putExtra("rrule", "FREQ=YEARLY"); | |
intent.putExtra("endTime", cal.getTimeInMillis() + 60 * 60 * 1000); | |
intent.putExtra("title", " Test Title"); | |
startActivity(intent); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment