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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:35:11+00:00 2026-06-07T16:35:11+00:00

In my project getting contacts is taking a long time to load. What are

  • 0

In my project getting contacts is taking a long time to load.

  • What are ways to reduce the time of getting contacts
  • Assume there are 1000 contacts in my phone.
  • Right now it is taking more than 2 minutes to load all the contacts

How can I reduce the time to load contacts ?
Any Thoughts?

I referred to the the following link when programming the initial method.

http://www.coderzheaven.com/2011/06/13/get-all-details-from-contacts-in-android/

  • 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-07T16:35:13+00:00Added an answer on June 7, 2026 at 4:35 pm

    Total time will depend upon what fields you are trying to access from the Contacts table.
    Accessing less field means less looping , less processing and hence faster results.

    Also to speed up your contacts fetch operation you can use the ContentProvideClient instead of calling query on ContentResolver every time. This will make you query the specific table rather than querying first for the required ContentProvider and then to table.

    Create an instance of ContentProviderClient

    ContentResolver cResolver=context.getContextResolver();
    ContentProviderClient mCProviderClient = cResolver.acquireContentProviderClient(ContactsContract.Contacts.CONTENT_URI);
    

    Then reuse this mCProviderClient to get Contacts(data from any ContentProvider) data on your call.
    For example in following method, I am accessing only one field.

    private ArrayList<String> fetchContactsCProviderClient()
        {
            ArrayList<String> mContactList = null;
            try
            {
                Cursor mCursor = mCProviderClient.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
                if (mCursor != null && mCursor.getCount() > 0)
                {
                    mContactList = new ArrayList<String>();
                    mCursor.moveToFirst();
                    while (!mCursor.isLast())
                    {
                        String displayName = mCursor.getString(mCursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
                        mContactList.add(displayName);
                        mCursor.moveToNext();
                    }
                    if (mCursor.isLast())
                    {
                        String displayName = mCursor.getString(mCursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
                        mContactList.add(displayName);
                    }
                }
    
                mCursor.close();
            }
            catch (RemoteException e)
            {
                e.printStackTrace();
                mContactList = null;
            }
            catch (Exception e)
            {
                e.printStackTrace();
                mContactList = null;
            }
    
            return mContactList;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my project i'm getting live camera images from remote bluetooth device. and now
I am working on existing project.Getting records something like this: $this->courses = Doctrine_Core::getTable('Course')->findByUserId($this->userId); Now
Please help me to fix this issue (Im getting crazy now!), My project is
Our Django project is getting huge. We have hundreds of apps and use a
I have two select queries to use in my project for getting data and
While working on an Xcode project i keep getting the spinning wheel while switching
when i tried to build my project i am getting this error below as:
I've decided to start running StyleCop on a medium sized project and am getting
I'm completely new to Visual Studio and I'm having some trouble getting a project
I am getting my senior project gallery-ready for a show this weekend. It 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.