Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7625127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:09:04+00:00 2026-05-31T05:09:04+00:00

I have made a custom list in which I am getting all the phone

  • 0

I have made a custom list in which I am getting all the phone book contacts and showing them in my own list with a custom view. I save all the contacts (inculding the contacts id) in an arraylist. When I click on a list I want it open all the details of that contact in the default android manner. Please can some one tell me if this is possible or not.

my code is below for saving the contacts in my own list:

arraylist = new ArrayList<PhoneBookUserEntity>();
    Cursor cursor = getContentResolver().query(
            ContactsContract.Contacts.CONTENT_URI, null, null, null, Phone.DISPLAY_NAME + " ASC");
    if (cursor.getCount() > 0)
    {
        while (cursor.moveToNext())
        {

            PhoneBookUserEntity user = new PhoneBookUserEntity();
            // Pick out the ID, and the Display name of the
            // contact from the current row of the cursor
            user.setId(cursor.getString(cursor.getColumnIndex(BaseColumns._ID)));
            user.setPhoneBookName(cursor.getString(cursor.getColumnIndex(
                    ContactsContract.Contacts.DISPLAY_NAME)));

            String hasPhone = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER)); 
            //    if (Boolean.parseBoolean(hasPhone)) { 
            Cursor phones = getContentResolver().query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ user.getId(), null, null); 
            while (phones.moveToNext()) { 
                user.sePhoneNumber(phones.getString(phones.getColumnIndex( ContactsContract.CommonDataKinds.Phone.NUMBER)));                 
            } 
            phones.close(); 
            //}
            // user.sePhoneNumber(cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))); 

            Cursor emails = getContentResolver().query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = " + user.getId(), null, null); 
            while (emails.moveToNext()) { 
                // This would allow you get several email addresses 
                user.setEmailAddress(emails.getString(emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA))); 
            } 
            emails.close(); 
            user.setImageURI(getPhotoUri(user.getId()));
            arraylist.add(user);
            // Do something with the values you have,
            // such as print them out or add to a list
            //System.out.println("Current contact on this iteration is : " + name);

            // This is where we query for Emails, Addresses etc
            // Add snippets below into here, depending on what you need
        }

    }
    cursor.close();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:09:05+00:00Added an answer on May 31, 2026 at 5:09 am

    Try this

    Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(contactID));
    intent.setData(uri);
    context.startActivity(intent);
    

    This should open the contacts card in android

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made my custom module in magento, in which I have set discount
I have images placed in following path res>drawable>Images>Currencies>[All images] I have made a custom
I have made a custom preference (i.e. a preference with a custom layout) which
I have made a custom listView which which extends ListActivity and each row contains
i have a ListView for which i have made a custom adapter which extends
I am running WSS3.0 and have a custom list which contains versioning on a
i have made a TableDataSource which uses my custom TableCell with two Buttons in
I have cells in UITableView , I have made custom frame for the label
I have made a custom form in a module where I have used a
I have made a custom formwizard and incorporated it into my admin interface. Basically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.