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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:12:38+00:00 2026-06-05T23:12:38+00:00

I try to read out all existing calendars. I tried the example from here:

  • 0

I try to read out all existing calendars. I tried the example from here:

http://developer.android.com/guide/topics/providers/calendar-provider.html

but I get following compile error: The method getContentResolver() is undefined for the type xxx
Can somebody help me please?

public HashMap<String, String> readCalendar() {     
String[] EVENT_PROJECTION = new String[] {
        Calendars._ID,   
        Calendars.OWNER_ACCOUNT,                    
        Calendars.ACCOUNT_NAME,                  
        Calendars.CALENDAR_DISPLAY_NAME                                   
    };
    String selectionICS = "((" + Calendars.ACCOUNT_NAME + " = ?) AND (" 
            + Calendars.ACCOUNT_TYPE + " = ?) AND ("
            + Calendars.OWNER_ACCOUNT + " = ?))";
    String[] selectionArgs = new String[] {"VISIBLE=1"}; // or "selected=1" ??

    Cursor managedCursor = null;
        ContentResolver cr = getContentResolver();
        managedCursor = cr.query(calendarUri, EVENT_PROJECTION, selectionICS, selectionArgs, null);selectionICS, selectionArgs, null);


}
  • 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-05T23:12:39+00:00Added an answer on June 5, 2026 at 11:12 pm

    getContentResolver() is a method of Context, so my guess is that your class is not derived from Activity (which is derived from Context).

    You have to use a context variable if you want to call it outside of an activity class (context.getContentResolver()). If your class is a BroadcastReceiver then the context variable is given as an argument in onReceive(). If not, you have to send it to your method when you call it.

    • 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 want have a HashMap with
when i try to read from a .aspx feed, the app gives me a
I see that when I try to read the value from a textarea field
I get a warning in MSVC++ when I try to read an integer from
I have a PLIST which contains 3 Dictionarys inside. http://dl.dropbox.com/u/9358444/auto1.plist I try to load
I am using a modified version of the TaskCloud example to try and read/write
I try to read an array using a function and use it in another
i try to read external data with file_get_contents with smarty However, i get this
I try to read file /proc/'pid'/status, using c program. The code is as follows,
When I try to read bash history into vim, I get nothing. :r !history

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.