0
나는 백업 및 연락처 데이터를 복원하기위한 프로그램을 작성 중입니다. 데이터 복원에 문제가 있습니다. 서버에서 데이터를 복원하기 전에 테이블에서 데이터를 삭제하려고하지만 ContentResolver에서 데이터를 삭제할 수 없습니다.raw_contact 및 데이터 테이블에서 데이터를 삭제하려면 어떻게해야합니까?
try {
JSONArray rawContacts = fillList(ContactsContract.RawContacts.CONTENT_URI);
JSONArray datas = fillList(ContactsContract.Data.CONTENT_URI);
//save json data to server
} catch (Exception e) {
e.printStackTrace();
}
public JSONArray fillList(Uri uri) throws Exception {
JSONArray arr = new JSONArray();
Cursor c = cr.query(uri, null, null, null, null);
if(c == null || c.getCount() == 0) {
Log.d("contact", "cursor is empty");
} else {
String[] columns = c.getColumnNames();
while(c.moveToNext()) {
JSONObject obj = new JSONObject();
for(String col : columns) {
int index = c.getColumnIndex(col);
obj.put(col, index);
}
arr.put(obj);
}
c.close();
}
return arr;
}
스택 추적이 있습니까? –
getContentResolver(). 삭제는 '삭제 된'열 0에서 1로 설정됩니다. – user1434702