Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, it appears that I have arrived at the solution for my problem on my own. (after having pulled the hair out of my head and becoming fashionably bald)</p> <p>It seems that the use of the Phone.TYPE was most definitely the problem, indeed. Phone.TYPE is a constant and not a data column.</p> <p>It turns out that the code that worked perfectly was this;</p> <pre><code> private void fillData() { // This goes and gets all the contacts that have mobile numbers final ArrayList&lt;String&gt; contacts = new ArrayList&lt;String&gt;(); // Let's set our local variable to a reference to our listview control // in the view. lvContacts = (ListView) findViewById(R.id.lvContacts); String[] proj_2 = new String[] {Data._ID, Phone.DISPLAY_NAME, CommonDataKinds.Phone.TYPE}; phnCursor = managedQuery(Phone.CONTENT_URI, proj_2, null, null, null); while(phnCursor.moveToNext()) { if ( phnCursor.getInt(2) == Phone.TYPE_MOBILE ) { String name = phnCursor.getString(1); contacts.add(name); } } // Make the array adapter for the listview. final ArrayAdapter&lt;String&gt; aa; aa = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_multiple_choice, contacts); // Let's sort our resulting data alphabetically. aa.sort(new Comparator&lt;String&gt;() { public int compare(String object1, String object2) { return object1.compareTo(object2); }; }); // Give the list of contacts over to the list view now. lvContacts.setAdapter(aa); } </code></pre> <p>I appreciate the help, but unfortunately must say that thorough bouts of madness and research eventually paid off. Hopefully this helps someone else out.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload