This is the method am using to get contact photo, number and name but am dong this from a Fragment.
1 Set the permission in your manifest.
<uses-permission android:name="android.permission.READ_CONTACTS" />
2 Declare a constant:
private static final int REQUEST_CODE_PICK_CONTACT = 1;
3 In my app the user is required to choose a phone contact by clicking on a button. So in the onClick() method I do this:
contactChooserButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivityForResult(new Intent(Intent.ACTION_PICK,
          ContactsContract.Contacts.CONTENT_URI), REQUEST_CODE_PICK_CONTACT);
        }
    });
4 Add the methods to retrieve photo, name, and number:
private String retrieveContactNumber() {
    String contactNumber = null;
    // getting contacts ID
    Cursor cursorID = getActivity().getContentResolver().query(uriContact,
            new String[]{ContactsContract.Contacts._ID},
            null, null, null);
    if (cursorID.moveToFirst()) {
        contactID = cursorID.getString(cursorID.getColumnIndex(ContactsContract.Contacts._ID));
    }
    cursorID.close();
    Log.e(TAG, "Contact ID: " + contactID);
    // Using the contact ID now we will get contact phone number
    Cursor cursorPhone = getActivity().getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
            new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER},
            ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ? AND " +
                    ContactsContract.CommonDataKinds.Phone.TYPE + " = " +
                    ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE,
            new String[]{contactID},
            null);
    if (cursorPhone.moveToFirst()) {
        contactNumber = cursorPhone.getString(cursorPhone.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
        phoneNumber = contactNumber;
    }
    cursorPhone.close();
    Log.e(TAG, "Contact Phone Number: " + contactNumber);
    return contactNumber;
}
 //Retrieve name
 private void retrieveContactName() {
    String contactName = null;
    // querying contact data store
    Cursor cursor = getActivity().getContentResolver().query(uriContact, null, null, null, null);
    if (cursor.moveToFirst()) {
        // DISPLAY_NAME = The display name for the contact.
        // HAS_PHONE_NUMBER =   An indicator of whether this contact has at least one phone number.
        contactName = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
        personName = contactName;
    }
    cursor.close();
    Log.e(TAG, "Contact Name: " + contactName);
}
//Retrieve photo (this method gets a large photo, for thumbnail follow the link below)
public void retrieveContactPhoto() {
    Uri contactUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long.parseLong(contactID));
    Uri displayPhotoUri = Uri.withAppendedPath(contactUri, ContactsContract.Contacts.Photo.DISPLAY_PHOTO);
    try {
        AssetFileDescriptor fd =
                getActivity().getContentResolver().openAssetFileDescriptor(displayPhotoUri, "r");
        photoAsBitmap = BitmapFactory.decodeStream(fd.createInputStream());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
finally, in your onActivityForResult method, do this:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);        
    try {
        if(requestCode == REQUEST_CODE_PICK_CONTACT && resultCode == Activity.RESULT_OK) {
            Log.e(TAG, "Response: " + data.toString());
            uriContact = data.getData();
            personPhoneTextField.setText(retrieveContactNumber()); 
//the method retrieveContactNumber returns the contact number, 
//so am displaying this number in my EditText after getting it.
//Make your other methods return data of 
//their respective types (Bitmap for photo)
  retrieveContactPhoto();
  retrieveContactName();
        }
    } catch (Exception exception) {
        exception.printStackTrace();
    }
}
That's it.For Activities, take a look at this Android: Get Contact Details (ID, Name, Phone, Photo) on Github