title: How to show phone contacts in a ListView
body: <p>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.</p>
  
  <pre><code>{
      //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);  
  }
  </code></pre>