Java: access protected static constants

I’m trying to read the contacts list on Android, and therefore need this code:

var name: String := c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); // or DISPLAY_NAME_PRIMARY 

docs: http://developer.android.com/reference/android/provider/ContactsContract.Contacts.html

According to the docs, the constants are derived from android.provider.ContactsContract.ContactsColumns, but I do not seem to be able to see them (and get a compiler error).

The above line is used in all the examples. But the problem is, I cannot access the constant DISPLAY_NAME. After reading some weblinks, others have this problem, too, who are indirect Java users. Conclusion of the discussions: Java expects PROTECTED STATIC constants to be accessible from outside the class.

Edit: as a workaround I have taken the actual string “display_name”. Luckily that’s stated in the docs…

Interesting one - the docs say it’s public static: http://developer.android.com/reference/android/provider/ContactsContract.ContactsColumns.html#DISPLAY_NAME

Thanks, logged as bugs://53623 for review
Posted by Bugs for Mac

@blong, you are right… Strange it cannot find it.