Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

import android.content.Context;

import android.content.Intent;

public class Main {
    public static Intent newCalendarIntent(Context context, Date startDate, String title, String location,
            String note) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(startDate);

        Intent intent = new Intent(Intent.ACTION_EDIT);
        intent.setType("vnd.android.cursor.item/event");
        intent.putExtra("beginTime", cal.getTimeInMillis());
        intent.putExtra("endTime", cal.getTimeInMillis() + 60 * 60 * 1000);
        intent.putExtra("allDay", true);
        //intent.putExtra("rrule", "FREQ=WEEKLY;COUNT="+numWeeks);
        //intent.putExtra("rrule", "FREQ=YEARLY");
        intent.putExtra("title", title);
        intent.putExtra("eventLocation", location);
        intent.putExtra("description", note);
        //intent.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE);
        //intent.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY);
        return intent;
    }
}