How can i know that a contact has number or not in android?
<p>How to know a contact have phone no or not?
Below is my code which gives me all contact name but some name dotn't have numbers so iwant know how can solve this situation...</p>

<pre><code>Cursor cursor = getContentResolver().query(
                ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
        while (cursor.moveToNext()) {
            String contactId = cursor.getString(cursor
                    .getColumnIndex(ContactsContract.Contacts._ID));

            contactName = cursor.getString(cursor
                    .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));

            System.out.println("Id= " + contactId);
            System.out.println("NAme= " + contactName);

            nameArray.add(contactName);

            Cursor phones = getContentResolver().query(
                    ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                    null,
                    ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = "
                            + contactId, null, null);
            while (phones.moveToNext()) {
                phoneNumber = phones
                        .getString(phones
                                .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                System.out.println("Phone no =" + phoneNumber);
                contactsArray.add(phoneNumber);

            }
            phones.close();
        }
        cursor.close();
</code></pre>
