public List GetContactList(){
List personenlist = new List();
personenlist.Initialize();
Uri personlist = ContactsContract.Contacts.CONTENT_URI;
String[] personlist_projection = new String[] {
ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.Contacts.HAS_PHONE_NUMBER,
};
Cursor cur = m_ba.activity.managedQuery(personlist, personlist_projection, null, null, null);
if (cur.getCount() > 0 ) {
cur.moveToFirst();
while (cur.isAfterLast() == false) {
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
if (Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
Cursor pCur = m_ba.activity.managedQuery(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?",
new String[]{id}, null);
while (pCur.moveToNext()) {
String PhoneNum = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DATA1));
personenlist.Add(name + "=" + PhoneNum );
//personenlist.Add(PhoneNum);
}
pCur.close();
}
//personen.Put(person_cur.getString(0), person_cur.getString(1));
cur.moveToNext();
}
cur.close();
}
return personenlist;
}