Work on contacts

This commit is contained in:
Joe Bowser
2009-11-02 15:43:09 -08:00
parent 25ff4b0eba
commit 7ead5ec2d8
7 changed files with 57 additions and 32 deletions
+39 -17
View File
@@ -1,43 +1,65 @@
package com.phonegap.demo;
import android.provider.Contacts.People;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.net.Uri;
import android.database.Cursor;
public class ContactManager {
public void grabContacts()
{
Uri people = android.provider.Contacts.People.CONTENT_URI;
Uri phone = android.provider.Contacts.Phones.CONTENT_URI;
}
Activity mApp;
Uri mPeople = android.provider.Contacts.People.CONTENT_URI;
Uri mPhone = android.provider.Contacts.Phones.CONTENT_URI;
Uri mEmail = android.provider.Contacts.ContactMethods.CONTENT_EMAIL_URI;
ContactManager(Activity app)
{
mApp = app;
}
private void getColumnData(Cursor cur){
ContentResolver cr = getContentResolver();
ContentResolver cr = mApp.getContentResolver();
if (cur.moveToFirst()) {
String name;
String phoneNumber;
int nameColumn = cur.getColumnIndex(People.NAME);
String email;
String phoneNumber;
int nameColumn = cur.getColumnIndex(People.NAME);
int phoneColumn = cur.getColumnIndex(People.NUMBER);
String imagePath;
do {
// Get the field values
name = cur.getString(nameColumn);
name = cur.getString(nameColumn);
phoneNumber = cur.getString(phoneColumn);
} while (cur.moveToNext());
}
}
public void findContacts()
{
// Form an array specifying which columns to return.
String[] projection = new String[] {
People._ID,
People.NAME,
People.NUMBER
};
// Make the query.
Cursor managedCursor = mApp.managedQuery(mPeople,
projection, // Which columns to return
null, // Which rows to return (all rows)
null, // Selection arguments (none)
// Put the results in ascending order by name
People.DISPLAY_NAME + " ASC");
this.getColumnData(managedCursor);
}
}