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 7941665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:44:14+00:00 2026-06-03T23:44:14+00:00

In my application I need to give user opportinity to see/edit all available fields

  • 0

In my application I need to give user opportinity to see/edit all available fields of ContactsContract.

How should I get/see all available fields – including any custom ones?

  • 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-06-03T23:44:15+00:00Added an answer on June 3, 2026 at 11:44 pm

    First get all of the names of people that exist in your phone:

    Cursor phones = getContentResolver().query(
                        ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                        null,
                        null,
                        null,
                        ContactsContract.Contacts.DISPLAY_NAME
                                + " COLLATE LOCALIZED ASC");
                while (phones.moveToNext()) {
    
                    name = phones
                            .getString(phones
                                    .getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
                    namelist.add(name);
                    String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                     number_list.add(phoneNumber);
                detaillist.put(name, phoneNumber);
                }
                phones.close();
    }
    

    Now get contact id and get other information like phone number, email id, address, organization by using contact id:

    protected void get_UserContactId(String item_clicked) 
            {
                System.out.println("i m in fincution contact id");
                ContentResolver localContentResolver = this.getContentResolver();
                Cursor contactLookupCursor =  
                   localContentResolver.query(
                            Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, 
                            Uri.encode(item_clicked)), 
                            new String[] {PhoneLookup.DISPLAY_NAME, PhoneLookup._ID}, 
                            null, 
                            null, 
                            null);
                try {
                while(contactLookupCursor.moveToNext()){
                  contactName = contactLookupCursor.getString(contactLookupCursor.getColumnIndexOrThrow(PhoneLookup.DISPLAY_NAME));
                    user_contact_id = contactLookupCursor.getString(contactLookupCursor.getColumnIndexOrThrow(PhoneLookup._ID));
    
                     System.out.println("contatc id id"+user_contact_id);
    
                    }
    
                }
            finally {
                contactLookupCursor.close();
                } 
    
            }
    
    
    protected void get_UserEmail(String item_clicked) 
            {
                Cursor emails = getContentResolver().query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = " + user_contact_id, null, null); 
                while (emails.moveToNext()) { 
                   // This would allow you get several email addresses 
                   user_email_id = emails.getString( 
                   emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)); 
                   String user_email_type=emails.getString( 
                           emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.TYPE)); 
                   System.out.println("the email type"+user_email_type);
                   System.out.println("email address might be"+emailAddress);
                contact_attribute_type.add(EMAIL_TYPE[(Integer.parseInt(user_email_type))-1]);
                contact_attribute_value.add(user_email_id);
                } 
                emails.close(); 
    
            }
    
            protected void get_UserNumber(String item_clicked) {
                // TODO Auto-generated method stub
                final String[] CONTACTS_SUMMARY_PROJECTION = new String[] {
                    ContactsContract.Contacts._ID,
                    ContactsContract.Contacts.DISPLAY_NAME,
                    ContactsContract.Contacts.STARRED,
                    ContactsContract.Contacts.TIMES_CONTACTED,
                    ContactsContract.Contacts.CONTACT_PRESENCE,
                    ContactsContract.Contacts.PHOTO_ID,
                    ContactsContract.Contacts.LOOKUP_KEY,
                    ContactsContract.Contacts.HAS_PHONE_NUMBER,
                };
    
    
    
                String select = "(" + ContactsContract.Contacts.DISPLAY_NAME + " == \"" +item_clicked+ "\" )";
                Cursor c = this.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, CONTACTS_SUMMARY_PROJECTION, select, null, ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC");
                this.startManagingCursor(c);
    
                if (c.moveToNext())
                {
                    String id = c.getString(0);
                    ArrayList<String> phones = new ArrayList<String>();
    
                    Cursor pCur = this.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?", new String[]{id}, null);
                    while (pCur.moveToNext())
                    {
                        phones.add(pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)));
                        user_number=pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                       String number_type=pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE));
                       System.out.println("the number type---"+number_type); 
                       System.out.println("user no. in share is"+user_number);
                       contact_attribute_type.add(PHONE_TYPE[(Integer.parseInt(number_type))-1]);
                       contact_attribute_value.add(user_number);
                     //   Log.i("", name_to_search+ " has the following phone number "+ pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)));
    
                    } 
                    pCur.close();   
                }
    
                }
    
    
            protected String get_UserAddress() {
                // TODO Auto-generated method stub
                try { 
    
                    System.out.println(" i m in user address");
                Cursor address = getContentResolver().query(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI,null, ContactsContract.CommonDataKinds.StructuredPostal.CONTACT_ID + " = " + client_contact_id, null, null); 
                    while (address.moveToNext()) { 
                       // This would allow you get several email addresses 
                      user_home_address = address.getString( 
                       address.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.DATA)); 
                      String user_address_type=address.getString( 
                               address.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.TYPE));
                      System.out.println("the user address type"+user_address_type);
                      System.out.println(" address might be"+user_home_address);
                    contact_attribute_type.add(ADDRESS_TYPE[(Integer.parseInt(user_address_type))-1]);
                    contact_attribute_value.add(user_home_address);
    
                    } 
                    address.close(); 
                }
                catch(Exception e)
                {
                    System.out.println("this exception due to website"+e);
                }
    
            return(user_home_address);  
            }   
    
    
              protected void get_UserWebsite() {
                    // TODO Auto-generated method stub
                            try{
                                Cursor websiteNameCursor = getContentResolver().query(ContactsContract.Data.CONTENT_URI,new String[] {Website.URL}, ContactsContract.Data.CONTACT_ID + " = " + user_contact_id + " AND ContactsContract.Data.MIMETYPE = '"
                                        + ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE
                                        + "'",null,null);
    
                                websiteNameCursor.moveToNext();
                                user_website=(websiteNameCursor.getString(websiteNameCursor.getColumnIndex(Website.URL)));
    
                                System.out.println("this is my website"+(websiteNameCursor.getString(websiteNameCursor.getColumnIndex(Website.URL))));
                            contact_attribute_type.add("Website");
                            contact_attribute_value.add(user_website);
    
                            }
                                catch(Exception e)
                                {
                                user_website=null;
                                System.out.println("this website is"+user_website); 
                                System.out.println("this exception in website"+e);
                                }
    
    
    
                }
    
                        protected void get_UserOrganization() {
                    // TODO Auto-generated method stub
                            try{
                                Cursor organizationNameCursor = getContentResolver().query(ContactsContract.Data.CONTENT_URI,new String[] {Organization.COMPANY}, ContactsContract.Data.CONTACT_ID + " = " + user_contact_id + " AND ContactsContract.Data.MIMETYPE = '"
                                        + ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE
                                        + "'",null,null);
    
                                organizationNameCursor.moveToNext();
                                user_company=organizationNameCursor.getString(organizationNameCursor.getColumnIndex(Organization.COMPANY));
                            //    String user_company_type=organizationNameCursor.getString(organizationNameCursor.getColumnIndex(Organization.TYPE));
                           //   System.out.println("the company type "+user_company_type);
                                System.out.println("this is my organization"+user_company);
    
                                contact_attribute_type.add("Company");
                            contact_attribute_value.add(user_company);
                            }
                                catch(Exception e)
                                {
                                user_company=null;
                                System.out.println("user company name is"+user_company);
                                    System.out.println("this exception in org"+e);
                                }
                }   
    
    
    
    
        }
    

    By doing this you can get all the fields of contacts-contract.

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

Sidebar

Related Questions

I'm working on a C# application and need to give the users a user-friendly
I'm working with one legacy application written in VB5, and I need to give
I need to give my user a web interface to change the session timeout
I'm trying to give the user ability to create customized list for my application,by
What permissions do I need to give a User for them to be able
I am already making the user give the permission for the application and it
Let's say I need to give the user the ability to choose by a
I'm developing an application where i need to create pdf file based on user
I am developing a web application in ASP.NET (C#) and need to give a
Please give me an idea about android User interface design.Is there any tool to

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.