I want to display contacts in carousel format. I have written an application for creating 3D carousel view using open gl es library. Now I want to display contacts using that application. How can I load the data of contacts into my application?
Asked
Active
Viewed 2,217 times
0
1 Answers
0
intent i = new Intent(Intent.ACTION_PICK,
ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(i, PICK_CONTACT);
public void onActivityResult(int reqCode, int resultCode, Intent data) {
super.onActivityResult(reqCode, resultCode, data);
switch (reqCode) {
case (PICK_CONTACT):
if (resultCode == Activity.RESULT_OK) {
Uri contactData = data.getData();
Cursor c = managedQuery(contactData, null, null, null, null);
if (c.moveToFirst()) {
// other data is available for the Contact. I have decided
// to only get the name of the Contact.
String name = c
.getString(c
.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
Toast.makeText(getApplicationContext(), name,
Toast.LENGTH_SHORT).show();
}
}
and see this link also
http://eclipsed4utoo.com/blog/android-open-contacts-activity-return-chosen-contact/

Avi Kumar
- 4,403
- 8
- 36
- 67