0

On Android, I try to retrieve some specific fields form a contact but I cant find how to do it.

I'd like to retrieve the following fields: "Enterprise", "Function", and "Label" and of course the fields "Name", "First Name" and "Phone number(s)"

The fields are here on a contact (numbered 1,2 and 3 on the screenshots): Screen 1 Screen 2

Is there some sample functions already available ????

Just to know how to get those fields. I'm not a java expert...

Christian
  • 1
  • 1
  • Please provide enough code so others can better understand or reproduce the problem. – Community Nov 30 '22 at 11:14
  • Does this answer your question? [Getting contact information from contact list with Kotlin](https://stackoverflow.com/questions/69382023/getting-contact-information-from-contact-list-with-kotlin) – Shark Nov 30 '22 at 11:25
  • You need to use a ContentResolver for that. – Shark Nov 30 '22 at 11:26

1 Answers1

0

I think you should use a Model with getter and setter methods. Than you can access all the fields with calling getter method.

Note: You have to save your data first.

Demo:

public class Person {
  private String name; // private = restricted access

  // Getter
  public String getName() {
    return name;
  }

  // Setter
  public void setName(String newName) {
    this.name = newName;
  }
}