Hi,

I am trying to change the value of the "user status" field in the
contacts of the adress book but I dont see my updates when i requery
the android.provider. could someone please let me know if im doing
something wrong. here is my relevant piece of code
-------------------
Uri myPeopleUri = android.provider.Contacts.People.CONTENT_URI;

        String[] projection = new String[] {
                        android.provider.BaseColumns._ID,
                        android.provider.Contacts.PeopleColumns.NAME,
                        android.provider.Contacts.PeopleColumns.NOTES,
                        android.provider.Contacts.People.USER_STATUS
        };

        Cursor cur = managedQuery(myPeopleUri,projection,null,null);

        if(cur.first()){
                String name;
                String status;
                String notes;

                int nameColumn =
cur.getColumnIndex(android.provider.Contacts.PeopleColumns.NAME);
                int statusColumn =
cur.getColumnIndex(android.provider.Contacts.People.USER_STATUS);
                int notesColumn =
cur.getColumnIndex(android.provider.Contacts.People.NOTES);

                do{
                        name =   cur.getString(nameColumn);
                        status = cur.getString(statusColumn);
                        notes  = cur.getString(notesColumn);

                        // Now update the status

                       cur.updateString(statusColumn, "Dummy status");
                       cur.updateString(notesColumn, "New random note");
                       cur.updateString(nameColumn, name+" New");
                       cur.commitUpdates(); // This is inefficient but just for
now

                } while(cur.next());

      }
           cur.requery();

    // When I again loop through the cursor..none of my fields are
changed!!!
------------------

Thanx,
Vinod
-------------
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to