0

I am trying to load my contacts into a ListView. I had no idea where to start, so I searched the www and found some examples. One of them (https://github.com/codepath/android_guides/wiki/Loading-Contacts-with-Content-Providers) describes the approach pretty well. Now I simply don't get, what the label is for.

I tried to reproduce the example and used

CharSequence mailType = ContactsContract.CommonDataKinds.Email.getTypeLabel(context.getResources(), type, null);

instead of

CharSequence emailType = ContactsContract.CommonDataKinds.Email.getTypeLabel(context.getResources(), type, customLabel);

as it is shown in the example, and every seems just fine to me. So what is that label for?

Thanks in advance!

Vic Torious
  • 1,757
  • 3
  • 21
  • 24
  • what is the label for? for what the docs say, did you read it? also when in doubts, you can always loook at sources – pskink Dec 02 '14 at 19:20
  • I did read the docs, but still did not find an answer. Maybe I searched the wrong place but the API says "Return a CharSequence that best describes the given type, possibly substituting the given LABEL value for TYPE_CUSTOM." but still I simply do not understand the use of label. – Vic Torious Dec 02 '14 at 19:34
  • so, as i said, if still in doubts: the sources for the rescue!! http://androidxref.com/5.0.0_r2/xref/frameworks/base/core/java/android/provider/ContactsContract.java#6047 – pskink Dec 02 '14 at 19:37
  • btw, the way your link's author reads the contacts' emails and phones is damn slow, see my answer here: http://stackoverflow.com/questions/26804387/android-fetch-all-contact-list-name-email-phone-takes-more-then-a-minute-for?answertab=oldest#tab-top – pskink Dec 02 '14 at 19:39
  • I have only a few contacts to load, so speed should be not a great problem there. Nevertheless I will study your answer and try to learn from it. Thank you for that one! – Vic Torious Dec 02 '14 at 19:58
  • now you have few contacts but in a week or month you can have hundrets of new friends, so be prepared – pskink Dec 02 '14 at 20:02

0 Answers0