• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Trying to read a Contact

ROHara

Lurker
I am trying to read from (and eventually write to) the Contacts database. Here is a code fragment:

String[] projection = new String[]
{ People._ID, People.NAME, People.NUMBER};
Uri contacts = Uri.parse("content://contacts/people");
Cursor mCursor = managedQuery(contacts, projection,
null, null, null);

In the emulator, this code fragment dies on the managedQuery call with this error:

java.io.IOException: An established connection was aborted by the software in your host machine

Adding the READ_CONTACTS permission has no effect. I am at a loss at how to debug this.

Does anyone out there see where I am going astray?

Thanks, Bob
 
I will answer my own question. It is necessary to go to the AndroidManifest and set uses-permissions to READ_CONTACTS. Then it all works, just like a real computer.
 
Back
Top Bottom