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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:13:54+00:00 2026-05-25T21:13:54+00:00

i’m confused and i need your help. I try to follow the instructions given

  • 0

i’m confused and i need your help.
I try to follow the instructions given by Virgil Dobjanschi on his lecture ‘Developing Android REST Client Applications‘ given on Google IO 2010. Unfortunately, i can’t find the way to implement valid communication between Content Provider and Cursor Adapter.

The problem i have here is linked with cursor adapter, so let’s just assume everything is fine with the content provider. For example, let’s try using Contacts ContentProvider instead of my own. I tried the simplest solution – any ContentProvider (as assumed, Contacts, provided by SDK) and SimpleCursorAdapter. The problem is that constructor of SimpleCursorAdapter containing the cursor from Contacts is deprecated. Documentations says:

This constructor is deprecated.

This option is discouraged, as it results in Cursor queries being performed on the application’s UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use LoaderManager with a CursorLoader.

My thoughts were: "Ok, i won’t use it. I’ll try LoaderManager with CursorLoader instead, as they are advicing me." So i went to the LoaderManager documentation site to find an example of use and what i found? Perfect example of using SimpleCursorAdapter constructor. Yes, the same i wanted to avoid becouse of it’s deprecation.

    // Create an empty adapter we will use to display the loaded data.
    mAdapter = new SimpleCursorAdapter(getActivity(),
            android.R.layout.simple_list_item_2, null,
            new String[] { Contacts.DISPLAY_NAME, Contacts.CONTACT_STATUS },
            new int[] { android.R.id.text1, android.R.id.text2 }, 0);
    setListAdapter(mAdapter);

All the tutorials i could find are using this deprecated constructor. Can anyone provide me good answer what’s the propper way to avoid using this? Or maybe i care about it too much? All i wanted was to learn good practices…

  • 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-25T21:13:55+00:00Added an answer on May 25, 2026 at 9:13 pm

    If you’re using LoaderManager on Android 2.2 you already have the Android compatibility library in your project I assume.

    In that case, don’t use

    android.widget.SimpleCursorAdapter
    

    because that class only has a single, now deprecated constructor. Instead use:

    android.support.v4.widget.SimpleCursorAdapter
    

    from the compat library. It has two constructors:

    SimpleCursorAdapter(Context, int, Cursor, String[], int[]) // deprecated
    SimpleCursorAdapter(Context, int, Cursor, String[], int[], int) // non-deprecated
    

    The code example in your question uses the second, non-deprecated constructor and thereby must be using the compat lib version of SimpleCursorAdapter.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I need to clean up various Word 'smart' characters in user input, including but
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites 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.