Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this code...</p> <pre class="lang-java prettyprint-override"><code>public class Utility { public static ArrayList&lt;String&gt; nameOfEvent = new ArrayList&lt;String&gt;(); public static ArrayList&lt;String&gt; startDates = new ArrayList&lt;String&gt;(); public static ArrayList&lt;String&gt; endDates = new ArrayList&lt;String&gt;(); public static ArrayList&lt;String&gt; descriptions = new ArrayList&lt;String&gt;(); public static ArrayList&lt;String&gt; readCalendarEvent(Context context) { Cursor cursor = context.getContentResolver() .query( Uri.parse("content://com.android.calendar/events"), new String[] { "calendar_id", "title", "description", "dtstart", "dtend", "eventLocation" }, null, null, null); cursor.moveToFirst(); // fetching calendars name String CNames[] = new String[cursor.getCount()]; // fetching calendars id nameOfEvent.clear(); startDates.clear(); endDates.clear(); descriptions.clear(); for (int i = 0; i &lt; CNames.length; i++) { nameOfEvent.add(cursor.getString(1)); startDates.add(getDate(Long.parseLong(cursor.getString(3)))); endDates.add(getDate(Long.parseLong(cursor.getString(4)))); descriptions.add(cursor.getString(2)); CNames[i] = cursor.getString(1); cursor.moveToNext(); } return nameOfEvent; } public static String getDate(long milliSeconds) { SimpleDateFormat formatter = new SimpleDateFormat( "dd/MM/yyyy hh:mm:ss a"); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(milliSeconds); return formatter.format(calendar.getTime()); } } </code></pre> <p>You can also check this </p> <p><a href="https://stackoverflow.com/questions/5883938/getting-events-from-calendar">Getting events from calendar</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload