user1096087
user1096087

Reputation: 33

Calendar event to specific day

How can I make programmatically a calendar event to the date 29/10/2012 at 18:00 hours? I use this but I don´t know very well how to pass the correct values to this date. Thank you

      Calendar cal = Calendar.getInstance();              
      Intent intent = new Intent(Intent.ACTION_EDIT);
      intent.setType("vnd.android.cursor.item/event");
      intent.putExtra("beginTime", cal.getTimeInMillis());
      intent.putExtra("allDay", true);
      intent.putExtra("rrule", "FREQ=YEARLY");
      intent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000);
      intent.putExtra("title", "Giranice");
      intent.putExtra("description", "Concierto Pop-Rock: Giranice (Gipuzkoa)");
      intent.putExtra("eventLocation", "Bilborock");
      startActivity(intent);
`

Upvotes: 0

Views: 822

Answers (1)

COD3BOY
COD3BOY

Reputation: 12092

I use this but I don´t know very well how to pass the correct values to this date

use this :

        Calendar cal = Calendar.getInstance();

        cal.set(Calendar.MONTH, month - 1);
        cal.set(Calendar.YEAR, year);
        cal.set(Calendar.DAY_OF_MONTH, day);
        cal.set(Calendar.HOUR_OF_DAY, hourOfTheDay);
        cal.set(Calendar.MINUTE, minute);

Hope you can understand all the parameters :)

Upvotes: 1

Related Questions