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 8096385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:26:17+00:00 2026-06-05T21:26:17+00:00

I try to read out all existing calendars. I want have a HashMap with

  • 0

I try to read out all existing calendars.

I want have a HashMap with all titles, accounts in it. Can somebody help me please? This is my try. In the LogCat I see all calendars.

public HashMap<String, String> readCalendar(Context context) {

    String[] EVENT_PROJECTION = new String[] {                  
        Calendars.ACCOUNT_NAME,                  
        Calendars.CALENDAR_DISPLAY_NAME                                   
    };

    Cursor managedCursor = null;
    HashMap<String, String> calendars = new HashMap<String, String>();
        Uri calendarUri = CalendarContract.Calendars.CONTENT_URI;
        ContentResolver cr = context.getContentResolver();
        managedCursor = cr.query(calendarUri, EVENT_PROJECTION, null, null, null);

        if (managedCursor != null && managedCursor.moveToFirst()) {


            do {
                    // here I see all accounts and names in the LogCat

                for (int i = 0; i < managedCursor.getColumnCount(); i++) {
                    Log.i(LOG_TAG, managedCursor.getColumnName(i) + "="
                            + managedCursor.getString(i));

                }

                String title = managedCursor.xxxxxx;   // I don't know how
                String account = managedCursor.xxxxx;  // I don't know how


                calendars.put(title, account);

            } while (managedCursor.moveToNext());

            managedCursor.close();
        } else {
            Log.i(LOG_TAG, "No Calendars");
                }
 return calendars;
    }
  • 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-06-05T21:26:18+00:00Added an answer on June 5, 2026 at 9:26 pm

    It seems you are looking for column names in the Calendars table. They are described in the API (the Calendar Columns section). The calls might look like this (if these are columns you want):

    String title = managedCursor.getString(managedCursor.getColumnIndex(
      CalendarContract.Calendars.NAME));
    String account = managedCursor.getString(managedCursor.getColumnIndex(
      CalendarContract.Calendars.ACCOUNT_NAME));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to read out all existing calendars. I tried the example from here:
I've read about Single-Page Applications recently and wanted to try one out. After watching
As a relative newbie I try to read as much as I can about
I have a quick and hopefully simple question that I hope someone can help
Basically I want to take a URLString and break out all variables and their
I have been trying to figure out how all this validation works, but I
I have 2 databases, and I want to transport an existing table containing a
I have been trying to figure this out all day. I've searched SO and
i try to read Data from an Oracle-Database. The problem is that in some
I try to read a text files with 20x20 data into variable C, and

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.