마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

연락처(contact) 수정(update) 관련 질문입니다.!!!!!!!뱅뱅뱅기

0 추천
초보개발잡니다...

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

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

이름을 수정하고 싶은데 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 = "01022222222";
          if (findSamePhoneId(cr, id, i) == true) {
           String where = ContactsContract.CommonDataKinds.Phone.NUMBER + " = '" + i + "'" + " AND "+
             ContactsContract.Data.RAW_CONTACT_ID + " = " + id +
                            " AND " + ContactsContract.Data.MIMETYPE + " == '" +
                            ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE + "'";

              String new_number = "sk";
              ContentValues values = new ContentValues();
              values.put(ContactsContract.CommonDataKinds.Note.NOTE , new_number);
             int count = cr.update(ContactsContract.Data.CONTENT_URI, values, where, null);
          }
      }
  }
뱅뱅뱅기 (280 포인트) 님이 2013년 4월 25일 질문

1개의 답변

0 추천
김생선 (3,310 포인트) 님이 2013년 4월 25일 답변
...