안녕하세요, 내 데이터베이스에서 동시에 여러 행을 삭제하려고 할 때 몇 가지 문제가 있습니다. 응용 프로그램을 디버깅 할 때 예외가 throw됩니다 (CursorIndexOutOfBoundsException) 및이 문제를 해결하는 방법을 알아낼 수 없습니다. 미리 감사드립니다.SQLite 데이터베이스에서 여러 행을 삭제할 때의 문제
btnDel.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
DBAdapter db = new DBAdapter(getBaseContext());
db.open();
Cursor c = db.getAllContacts();
int rowId = c.getInt(0);
while(c.getCount() > 50)
{
db.deleteContact(rowId);
Toast.makeText(getBaseContext(), "Deleted", Toast.LENGTH_SHORT).show();
}
db.close();
}
});
사실 나는 이전 항목 (낮은 _id로 행)을 제거하는 행의 수를 50 개로 제한하려고 시도하고 있지만 이것은 이미 많은 도움을주었습니다. 감사합니다. –