简体   繁体   中英

How to do a listview of contacts?

I'm creating an App, that has people phone contacts and some they've made via our system. But, I've finished the login screen, but now I'm on the main class that displays all their contacts in a listview, with their latest message under each contact.

TL;DR How can I display a bunch of contacts and under each one display the latest message received.

Thanks

I'm going to try to break the answer into three sections. Have you stored the contacts information in the Contacts Content Provider?

a. This example from google shows how you can query the Contacts content provider to get a list of all the contacts details like so

在此处输入图片说明

b. To show the latest message received from each contact, you will need to create a custom ListView where you show the message below a contact. An example of creating a custom ListView can be found here.

c. By messages, if you are referring to SMS/text, you can access that information separately. A tutorial on how to do that can be found here.

So to summarize, you will have to combine the contacts example, the custom ListView example and the SMS example to get the result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM