in my app there are 5 spinners populated with the contacts in the phone. I am using the code below to populate an array with the contacts and then populate the spinners with
Your Spinners would populate a lot faster if you used a break
to jump out of your for
-loop once you assign
num = i
I would say that the way you query your contacts data is wrong.
It looks like you're fetching ALL your contacts with all the contact's data from the database, and then filtering the contacts in a while loop. I would suggest doing this from within the query, something like this (not tested):
Cursor cur = cr.query(
ContactsContract.Contacts.CONTENT_URI,
new String[] { "_ID", "DISPLAY_NAME" },
"HAS_PHONE_NUMBER = ?", new String[] { "1" },
null);