简体   繁体   English

将检索到的联系人存储在我们自己的android应用中的最佳方法?

[英]Best way to store retrieved contacts in our own android app?

I tried using hashmap, but some suggested that hash map is not reliable to store contacts. 我尝试使用哈希图,但有人建议哈希图对存储联系人不可靠。 And I cannot perform retrieve operation every time I run the app. 而且,我每次运行应用程序时都无法执行检索操作。 So suggest me any useful way to store contacts. 因此,建议我任何有用的方式来存储联系人。 If possible provide me the link, so that it helps me for further reference. 如果可能的话,请提供链接,以帮助我进一步参考。

This is code for retrieve contacts from phone 这是用于从电话检索联系人的代码

 Cursor cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);

  while (cursor.moveToNext()) {

   String name = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME_PRIMARY));

   String phonenumber = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));

 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 哪种方式最适合在Android中存储我们的应用程序设置 - which way is best to store our application settings in Android 创建并托管我们自己的私人android商店 - Creating and hosting our own private android store 在Android应用中存储单个用户的最佳方法? - Best way to store a single user in an Android app? 在Android应用程序中存储文本数据的最佳方法? - Best way to store text data in an android app? 这是在Android应用中存储“引号”的最佳方法 - Which is the best way to store “quotes” in an android app 为Android应用程序存储应用程序导航的最佳方法? - Best way to store application navigation for Android app? 从我们自己的服务器(而非Play商店)分发的Android应用的引荐/邀请跟踪 - Referral/Invite Tracking for Android app distributed from our own server instead of Play Store Android录制我们自己的应用程序的声音 - Android record sound of our own app 如何以编程方式将我们的应用程序联系人同步到android上的本机联系人 - How to sync our app contacts into native contact app on android programmatically 在Android应用中将列表存储为我自己的类的最简单方法? - Easiest way to store a list a my own class in a android app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM