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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:44:59+00:00 2026-05-31T05:44:59+00:00

Following is my code, actually on screen it’s not showing me any contact. In

  • 0

Following is my code, actually on screen it’s not showing me any contact. In emulator I have 5 contacts added. Please tell me what to do.

{
    //some code
    Cursor cur = getContacts();
    String[] fields = new String[] {ContactsContract.Data.DISPLAY_NAME};
    SimpleCursorAdapter adapter = 
        new SimpleCursorAdapter(this, 
                                R.layout.list_view_item_new,
                                cur,
                                fields,
                                new int[] {R.id.contactEntryText});
    lv.setAdapter(adapter);
}

private Cursor getContacts() {  
    // Run query     
    Uri uri = ContactsContract.Contacts.CONTENT_URI;
    String[] projection = 
        new String[]{ ContactsContract.Contacts._ID,
                      ContactsContract.Contacts.DISPLAY_NAME }; 
    String selection = null;
    String[] selectionArgs = null;  
    String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + 
        " COLLATE LOCALIZED ASC";  
    return managedQuery(uri, projection, selection, selectionArgs, sortOrder);  
}
  • 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-31T05:45:00+00:00Added an answer on May 31, 2026 at 5:45 am

    I have copied and executed almost the same code and it works:

        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            Cursor cur = getContacts();
    
            ListView lv = getListView();
    
           String[] fields = new String[] {ContactsContract.Data.DISPLAY_NAME};
    
           SimpleCursorAdapter adapter = 
                    new SimpleCursorAdapter(this, 
                                            R.layout.main,
                                            cur,
                                            fields,
                                            new int[] {R.id.txtbox});
              lv.setAdapter(adapter);         
        }    
    
        private Cursor getContacts() {  
            // Run query     
            Uri uri = ContactsContract.Contacts.CONTENT_URI;
    
            String[] projection = 
                    new String[]{ ContactsContract.Contacts._ID,
                                  ContactsContract.Contacts.DISPLAY_NAME }; 
                String selection = null;
                String[] selectionArgs = null;  
                String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + 
                    " COLLATE LOCALIZED ASC";  
                return managedQuery(uri, projection, selection, selectionArgs, sortOrder);
        }
    

    Please check if you have done anything wrong in the textview implementation?

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

Sidebar

Related Questions

Is there any way I could run the following 'logical code' to actually work?
I was trying out the following code which actually saves the pdf file to
Despite being a Project Euler program, the following code doesn't actually concern it much.
I have the following css code .container { width:800px; background-color:yellow; margin:auto; display:table; } .cell
I have the following code in my activity. In my xml, the video view
I'm trying to remove all Sprites (UIImageViews) on my screen with the following code:
I have the following code $(document).ready(function(){ $('img').mousedown(function(event) { $('p').text('Mouse Clicked x =' + event.screenX
Following code iterates through many data-rows, calcs some score per row and then sorts
following code doesn't work with input: 2 7 add Elly 0888424242 add Elly 0883666666
Following code is from a sample of playframework-2.0: /** * Display the dashboard. */

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.