A: 

Did you enable android.permission.READ_CONTACTS in your manifest?

RickNotFred
A: 

Hello, I'm reading the same book (Apress Android 2 Pro, source code at http://www.apress.com/book/downloadfile/4529 - example /Ch4/Listing4-17)

I found when I copied / pasted it into an eclipse project, it didn't work for the simple reason that I hadn't set the package name at the top of the pasted source file.

Try putting:

package asdf.adsf;

...(with your actual package name ;-), at the top of the java file, maybe that will help. The problem was that it wasn't using the project-specific 'R' resource class.

Idris