Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5959087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:38:11+00:00 2026-05-22T18:38:11+00:00

My issue is, I have to make one demo application in which I wants

  • 0

My issue is, I have to make one demo application in which I wants to read the events of the Google calendar, for that I have manually inserted the events like the title of event, the time of events and the details of the whole events. now I need to just read those events form that calendar.
For that I have tried to use the gcode(google code) API which provides the calendar API class. But still I cant read those events.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:38:12+00:00Added an answer on May 22, 2026 at 6:38 pm

    Ok i found the answer of this whole of the concept that how to use the google calendar application integration with the android phone.

    code:–

    first you set this line which will goes to read the calendar events form the other class form your class which is current is the ApplicationSettings.java .

    ReadCalendar.readCalendar(ApplicationSettings.this);

    package com.mycalendarevents.android;
    
    import java.util.Date;
    import java.util.HashSet;
    import java.util.regex.Pattern;
    
    import android.content.ContentResolver;
    import android.content.ContentUris;
    import android.content.Context;
    import android.database.Cursor;
    import android.net.Uri;
    import android.text.format.DateUtils;
    
    public class ReadCalendar
    {
        static Cursor cursor;
    
        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
    
            cursor = contentResolver.query(Uri.parse("content://com.android.calendar/calendars"),
                    (new String[] { "_id", "displayName", "selected"}), null, null, null);
    
            HashSet<String> calendarIds = new HashSet<String>();
    
            try
            {
                System.out.println("Count="+cursor.getCount());
                if(cursor.getCount() > 0)
                {
                    System.out.println("the control is just inside of the cursor.count loop");
                    while (cursor.moveToNext()) {
    
                        String _id = cursor.getString(0);
                        String displayName = cursor.getString(1);
                        Boolean selected = !cursor.getString(2).equals("0");
    
                        System.out.println("Id: " + _id + " Display Name: " + displayName + " Selected: " + selected);
                        calendarIds.add(_id);
                    }
                }
            }
            catch(AssertionError ex)
            {
                ex.printStackTrace();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
    
    
            // 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://com.android.calendar/instances/when").buildUpon();
                //Uri.Builder builder = Uri.parse("content://com.android.calendar/calendars").buildUpon();
                long now = new Date().getTime();
    
                ContentUris.appendId(builder, now - DateUtils.DAY_IN_MILLIS * 10000);
                ContentUris.appendId(builder, now + DateUtils.DAY_IN_MILLIS * 10000);
    
                Cursor eventCursor = contentResolver.query(builder.build(),
                        new String[]  { "title", "begin", "end", "allDay"}, "Calendars._id=" + 1,
                        null, "startDay ASC, startMinute ASC");
    
                System.out.println("eventCursor count="+eventCursor.getCount());
                if(eventCursor.getCount()>0)
                {
    
                    if(eventCursor.moveToFirst())
                    {
                        do
                        {
                            Object mbeg_date,beg_date,beg_time,end_date,end_time;
    
                            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);
                            */
                            System.out.println("Title:"+title);
                            System.out.println("Begin:"+begin);
                            System.out.println("End:"+end);
                            System.out.println("All Day:"+allDay);
    
                            /* the calendar control metting-begin events Respose  sub-string (starts....hare) */
    
                            Pattern p = Pattern.compile(" ");
                            String[] items = p.split(begin.toString());
                            String scalendar_metting_beginday,scalendar_metting_beginmonth,scalendar_metting_beginyear,scalendar_metting_begindate,scalendar_metting_begintime,scalendar_metting_begingmt;
    
                            scalendar_metting_beginday = items[0];
                            scalendar_metting_beginmonth = items[1];
                            scalendar_metting_begindate = items[2];
                            scalendar_metting_begintime = items[3];
                            scalendar_metting_begingmt = items[4];
                            scalendar_metting_beginyear = items[5];
    
    
                            String  calendar_metting_beginday = scalendar_metting_beginday;
                            String  calendar_metting_beginmonth = scalendar_metting_beginmonth.toString().trim();
    
                            int  calendar_metting_begindate = Integer.parseInt(scalendar_metting_begindate.trim());
    
                            String calendar_metting_begintime = scalendar_metting_begintime.toString().trim();
                            String calendar_metting_begingmt = scalendar_metting_begingmt;
                            int calendar_metting_beginyear = Integer.parseInt(scalendar_metting_beginyear.trim());
    
    
                            System.out.println("calendar_metting_beginday="+calendar_metting_beginday);
    
                            System.out.println("calendar_metting_beginmonth ="+calendar_metting_beginmonth);
    
                            System.out.println("calendar_metting_begindate ="+calendar_metting_begindate);
    
                            System.out.println("calendar_metting_begintime="+calendar_metting_begintime);
    
                            System.out.println("calendar_metting_begingmt ="+calendar_metting_begingmt);
    
                            System.out.println("calendar_metting_beginyear ="+calendar_metting_beginyear);
    
                              /* the calendar control metting-begin events Respose  sub-string (starts....ends) */  
    
                            /* the calendar control metting-end events Respose  sub-string (starts....hare) */
    
                            Pattern p1 = Pattern.compile(" ");
                            String[] enditems = p.split(end.toString());
                            String scalendar_metting_endday,scalendar_metting_endmonth,scalendar_metting_endyear,scalendar_metting_enddate,scalendar_metting_endtime,scalendar_metting_endgmt;
    
                            scalendar_metting_endday = enditems[0];
                            scalendar_metting_endmonth = enditems[1];
                            scalendar_metting_enddate = enditems[2];
                            scalendar_metting_endtime = enditems[3];
                            scalendar_metting_endgmt = enditems[4];
                            scalendar_metting_endyear = enditems[5];
    
    
                            String  calendar_metting_endday = scalendar_metting_endday;
                            String  calendar_metting_endmonth = scalendar_metting_endmonth.toString().trim();
    
                            int  calendar_metting_enddate = Integer.parseInt(scalendar_metting_enddate.trim());
    
                            String calendar_metting_endtime = scalendar_metting_endtime.toString().trim();
                            String calendar_metting_endgmt = scalendar_metting_endgmt;
                            int calendar_metting_endyear = Integer.parseInt(scalendar_metting_endyear.trim());
    
    
                            System.out.println("calendar_metting_beginday="+calendar_metting_endday);
    
                            System.out.println("calendar_metting_beginmonth ="+calendar_metting_endmonth);
    
                            System.out.println("calendar_metting_begindate ="+calendar_metting_enddate);
    
                            System.out.println("calendar_metting_begintime="+calendar_metting_endtime);
    
                            System.out.println("calendar_metting_begingmt ="+calendar_metting_endgmt);
    
                            System.out.println("calendar_metting_beginyear ="+calendar_metting_endyear);
    
                              /* the calendar control metting-end events Respose  sub-string (starts....ends) */
    
                            System.out.println("only date begin of events="+begin.getDate());
                            System.out.println("only begin time of events="+begin.getHours() + ":" +begin.getMinutes() + ":" +begin.getSeconds());
    
    
                           System.out.println("only date begin of events="+end.getDate());
                            System.out.println("only begin time of events="+end.getHours() + ":" +end.getMinutes() + ":" +end.getSeconds());
    
                            beg_date = begin.getDate();
                            mbeg_date = begin.getDate()+"/"+calendar_metting_beginmonth+"/"+calendar_metting_beginyear;
                            beg_time = begin.getHours();
    
                            System.out.println("the vaule of mbeg_date="+mbeg_date.toString().trim());
                            end_date = end.getDate();
                            end_time = end.getHours();
    
    
                            CallHandlerUI.metting_begin_date.add(beg_date.toString());
                            CallHandlerUI.metting_begin_mdate.add(mbeg_date.toString());
    
                            CallHandlerUI.metting_begin_mtime.add(calendar_metting_begintime.toString());
    
                            CallHandlerUI.metting_end_date.add(end_date.toString());
                            CallHandlerUI.metting_end_time.add(end_time.toString());
                            CallHandlerUI.metting_end_mtime.add(calendar_metting_endtime.toString());
    
                        }
                        while(eventCursor.moveToNext());
                    }
                }
                break;
            }
        }
    }
    

    here is the whole of the code is to be posted which will simply reads each and every events form your calendar with the help of that postback url which is for 2.2 and above version:

    Uri.parse("content://com.android.calendar/instances/when").buildUpon();
    

    pl find the under those version lower then 2.2 in android and use those events as you required place…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here i have one function which is call many times in one application this
I have an issue. I am getting data from a MySQL database, and make
I have an issue. We have a website, where person can login and make
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
The issue I have is that I want to parse strings in order, so
Here's the issue: I have 2 data contexts that I would like to do
Now a days, I make one application in Silverlight to get Emails from MS
I have an application that sits on IE. Police officers use it in their
The issue: I have a timesheet application. It has an SQlite database. I am
I have a Person table that has a nullable AddressId in it which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.