I'm developing an Android app using "android.permission.SEND_SMS" to opne contact list and display it. My app run just fine, but when I pick a contact from my list it only display the first contact phone number for any contact I pick. This is my code. Thank you.
public void onActivityResult(int reqCode, int resultCode, Intent data) {
super.onActivityResult(reqCode, resultCode, data);
Cursor people = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
new String[] {ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER},
null, null, null);
int indexNumber = people.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
people.moveToFirst();
String number;
do {
number = people.getString(indexNumber);
} while (people.moveToNext());
phoneNumber.setText(number);
}