how to integrate default app of android in our app programatically
<p>Is it possible to integrate the default app(like <strong>Calendar</strong>) of Android  in our app programatically .
Can anyone explain me in details....</p>

<p>The two classes that I am using are:
<strong>MainActivity.java</strong></p>

<pre><code>public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Example.readCalendar(this);
    }
}
</code></pre>

<p>and another class <strong>Example.java</strong></p>

<pre><code>public class Example {

    public static void readCalendar(Context context) {

        ContentResolver contentResolver = context.getContentResolver();

        // Fetch a list of all calendars synced with the device, their display names and whether the
        // user has them selected for display.

        final Cursor cursor = contentResolver.query(Uri.parse("content://calendar/calendars"),
                (new String[] { "_id", "displayName", "selected" }), null, null, null);
        // For a full list of available columns see http://tinyurl.com/yfbg76w

        HashSet&lt;String&gt; calendarIds = new HashSet&lt;String&gt;();

        while (cursor.moveToNext()) {

            final String _id = cursor.getString(0);
            final String displayName = cursor.getString(1);
            final Boolean selected = !cursor.getString(2).equals("0");

            System.out.println("Id: " + _id + " Display Name: " + displayName + " Selected: " + selected);
            calendarIds.add(_id);
        }

        // For each calendar, display all the events from the previous week to the end of next week.        
        for (String id : calendarIds) {
            Uri.Builder builder = Uri.parse("content://calendar/instances/when").buildUpon();
            long now = new Date().getTime();
            ContentUris.appendId(builder, now - DateUtils.WEEK_IN_MILLIS);
            ContentUris.appendId(builder, now + DateUtils.WEEK_IN_MILLIS);

            Cursor eventCursor = contentResolver.query(builder.build(),
                    new String[] { "title", "begin", "end", "allDay"}, "Calendars._id=" + id,
                    null, "startDay ASC, startMinute ASC"); 
            // For a full list of available columns see http://tinyurl.com/yfbg76w

            while (eventCursor.moveToNext()) {
                final String title = eventCursor.getString(0);
                final Date begin = new Date(eventCursor.getLong(1));
                final Date end = new Date(eventCursor.getLong(2));
                final Boolean allDay = !eventCursor.getString(3).equals("0");

                System.out.println("Title: " + title + " Begin: " + begin + " End: " + end +
                        " All Day: " + allDay);
            }
        }
    }


}
</code></pre>

<p>I have added the READ_CALENDAR permission also.</p>
