Query:
public Cursor queryAll(String[] returnSequence) {
Cursor cusor = null;
ContentResolver contentResolver = mContext.getContentResolver();
cusor = contentResolver.query(Contacts.People.CONTENT_URI, returnSequence,
null, null, null);// DEFAULT_SORT_ORDER
return cusor;
}
public Cursor queryByName(String[] returnSequence, String name) {
Cursor cusor = null;
ContentResolver contentResolver = mContext.getContentResolver();
cusor = contentResolver.query(Contacts.People.CONTENT_URI, returnSequence,
Contacts.People.NAME + "=?", new String[] { name }, Contacts.People.NAME + "
ASC");// DEFAULT_SORT_ORDER
return cusor;
}
update:
String[] projection = new String[] { Contacts.People._ID, Contacts.People.NAME,
Contacts.People.NUMBER };
cusor = contentResolver.query(Contacts.People.CONTENT_URI, projection,
Contacts.People.NAME + "=?", new String[] { oldName }, Contacts.People.NAME + "
ASC");
cusor.moveToFirst();
ContentValues values = new ContentValues();
Uri uri = Uri.withAppendedPath(Contacts.People.CONTENT_URI,
cusor.getString(cusor.getColumnIndex(Contacts.People._ID)));
values.put(Contacts.People.NAME, newName);
values.put(Contacts.People.STARRED, 0);
contentResolver.update(uri, values, null, null);
[EMAIL PROTECTED]
2008年10月16日
----- Original Message -----
From: Alexandru Mos
To: android-developers
Sent: 2008-10-02, 23:32:49
Subject: [android-developers] Contacts DataBase
I have 2 questions. Do you know why I can't update the contact phone
numbers and how can I read an IM (Instant message) account in the new
version of sdk (v 1.0) ?
--
Ing. Alexandru Mos
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---