在Android中获取新插入的联系人 [英] Getting newly inserted contacts in Android

查看:88
本文介绍了在Android中获取新插入的联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我正在提取所有联系人并将其上传到服务器。但是有一个问题。我知道如何提取所有联系人,但是有什么方法可以获取最新的联系人?

In my application, I'm extracting all the contacts and upload them to the server. But there's a problem. I know how to extract all the contacts, but is there any way to get the newest contacts?

例如:第一次打开应用程序时,我将所有联系人,但其他时候我不想全部上传,只是最新的。

For example: The first time I open the app, I upload all the contacts but the other times I don't want to upload all of them, just the newest.

您知道吗?

谢谢!

推荐答案

如果您的联系人有一些命令(按ID,按名称),您可以保存最后一次保存的联系人的标识符,下次只需查看是否有一个标识符大于您最后保存的标识符。

If your contacts have some order (by ID, by Name), you can save the identifier of the last contact you saved and the next time just check to see if there is a contact with identifier bigger than the last one you saved.

例如:


  1. 您保存联系人列表和最后保存的联系人ID(假设已排序,如果没有排序)然后保存最大值)为100。

  2. 下一次运行,检查是否有ID> 100的联系人,然后保存,然后再次保存最后插入的ID。

这篇关于在Android中获取新插入的联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆