PHOTO cannot be resolved or is not a field
<p>I am trying to implement the example Android code given here:
<a href="http://developer.android.com/reference/android/provider/ContactsContract.Contacts.Photo.html" rel="nofollow">http://developer.android.com/reference/android/provider/ContactsContract.Contacts.Photo.html</a>
to grab the thumbnails of contacts (the top example code). </p>

<p>However, I can't get beyond the error:
'PHOTO cannot be resolved or is not a field' </p>

<p>This is the code:</p>

<pre><code>public InputStream openPhoto(long contactId) 
    {
        Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
        Uri photoUri = Uri.withAppendedPath(contactUri, Contacts.Photo.CONTENT_DIRECTORY);
        Cursor cursor = getContentResolver().query(photoUri,
             new String[] {Contacts.Photo.PHOTO}, null, null, null);
        if (cursor == null) {
            return null;
        }
        try {
            if (cursor.moveToFirst()) {
                byte[] data = cursor.getBlob(0);
                if (data != null) {
                    return new ByteArrayInputStream(data);
                }
            }
        } finally {
            cursor.close();
        }
        return null;
    }
</code></pre>

<p>I have the following imports listed at the top of the class file:</p>

<pre><code>import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.lang.Object;

import android.app.Activity;
import android.content.ContentUris;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract.CommonDataKinds.Photo;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;
</code></pre>

<p>I am sure that it is something really simple, like a missing import, but I am at a loss. Any help would be much appreciated. </p>
