초보개발잡니다...

처음으로 연락처에 접근하는법을 하고있습니다..

기존에 저장되어있는 번호를 이용해

이름을 수정하고 싶은데 where(조건) 사용법도 잘 모르겠고...

update하는 것도 잘 모르겠습니다....

최종적으로 번호를 이용해 해당 이름을 수정 하고싶습니다..ㅠㅠㅠㅠㅠㅠ

 

고수분들 도와주세요 ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ

 

이건 제가 고민하던 소스 입니다....

 

Cursor c = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
  if (c.getCount() > 0) {
      while (c.moveToNext()) {
          String id = c.getString(c.getColumnIndex(ContactsContract.Contacts._ID));
          String i = "010222222222";
          if (findSamePhoneId(cr, id, i) == true) {
           String where = ContactsContract.CommonDataKinds.Phone.NUMBER + " = " + i;

              String new_number = "01055555555";
              ContentValues values = new ContentValues();
              values.put(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, new_number);
             int count = cr.update(ContactsContract.Data.CONTENT_URI, values, where, null);
          }
      }
  }