3

I am trying to develop a query to retrieve contacts. However, Eclipse keeps telling me that PHOTO_THUMBNAIL_URI and PHOTO_URI cannot be resolved or is not a field. Here's my code:

Uri uri = ContactsContract.Contacts.CONTENT_URI;
    String[] projection = new String[] {
            ContactsContract.Contacts._ID,
            ContactsContract.Contacts.DISPLAY_NAME,
            ContactsContract.Contacts.HAS_PHONE_NUMBER,
            ContactsContract.Contacts.LOOKUP_KEY,
            ContactsContract.Contacts.PHOTO_THUMBNAIL_URI,
            ContactsContract.Contacts.PHOTO_URI,
            ContactsContract.Contacts.PHOTO_ID
    };

How do I solve this?

mmmmm5
  • 151
  • 1
  • 1
  • 14

1 Answers1

1

The PHOTO_THUMBNAIL_URI and PHOTO_URI are only available since API level 11 (Android 3.0). Make sure to set up your project/manifest accordingly.

For the project, in Eclipse, you'll need to go into your project properties, then, in the Android section, select "Android 3.0" (or higher). For the manifest, you'll need something like that:

<uses-sdk android:minSdkVersion="11"/>

If you need your application to work on prior versions on Android, you might want to use a Support package to keep it to a single APK and code base.

XMoby
  • 171
  • 4