
如何在FireMonkey移动应用程序中获取手机的联系人列表?最佳答案在这里你去..它没有完成,因为它读取一个人的所有数字,如果有两个数字,你将有两次这个人在列表中列出..但从这里我认为你可以工作,并根据你的需要调整它:) )
function GetContact: TStringList;varcursorContacts,cursorContactsPhone: JCursor;hasPhoneNumber: Integer;ID: Int64;displayname,phoneNumber,contactID: string;beginResult := TStringList.Create;cursorContacts := SharedActivity.getContentResolver.query(TJContactsContract_Contacts.JavaClass.CONTENT_URI,nil,nil);if (cursorContacts.getCount > 0) thenbeginwhile (cursorContacts.movetoNext) dobeginID := cursorContacts.getLong(cursorContacts.getColumnIndex(StringToJstring('_ID')));displayname := JstringToString(cursorContacts.getString(cursorContacts.getColumnIndex(StringToJstring('disPLAY_name'))));hasPhoneNumber := cursorContacts.getInt(cursorContacts.getColumnIndex(StringToJstring('HAS_PHONE_NUMBER')));if (hasPhoneNumber > 0) thenbegincursorContactsPhone := SharedActivity.getContentResolver.query(TJCommonDataKinds_Phone.JavaClass.CONTENT_URI,StringToJstring('CONTACT_ID = ' + IntToStr(ID)),nil);while (cursorContactsPhone.movetoNext) dobeginphoneNumber := JstringToString(cursorContactsPhone.getString(cursorContactsPhone.getColumnIndex(StringToJstring('DATA1'))));contactID := JstringToString(cursorContactsPhone.getString(cursorContactsPhone.getColumnIndex(StringToJstring('CONTACT_ID'))));Result.Add(displayname + ': ' + phoneNumber);end;cursorContactsPhone.close;end;end;end;cursorContacts.close;end;最好的祝福,
Kruno 总结
以上是内存溢出为你收集整理的android – 如何在Firemonkey移动应用程序中获取手机的联系人列表?全部内容,希望文章能够帮你解决android – 如何在Firemonkey移动应用程序中获取手机的联系人列表?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)