db 에 저장된 목록을 listactivity 를 통해 list 형식으로 보여 준뒤
해당 list 를 클릭을 하면 db 에 저장된 데이터 내용을 띄어 주도록 구현을 하였습니다
그런데 cursorindexoutofboundsexception index 0 requested with a size of 0 이 에러가 나는 원인이 무엇인지 알려주시면 감사하겠습니다
protected void onListItemClick(android.widget.ListView l, View v,
int
position, long id) {
// TODO Auto-generated method stub
DBHandler
dbhandler=DBHandler.open(this);
super.onListItemClick(l, v, position,
id);
Cursor cursor=dbhandler.select(position);
if(cursor!=null)
{cursor.moveToFirst();}
startManagingCursor(cursor);
String
name=cursor.getString(cursor.getColumnIndex("car_name"));
Toast.makeText(this,
name,Toast.LENGTH_LONG).show();
이런식으로 구현을 햇는데
cursorindexoutofboundsexception index 0 requested with a size of 0
이 에러가 나는 원인이 무엇인지 알수 있을까요?
읽어보진 않았고..
코드 짜시다가 Exception이 발생한다면 근처에 Log 찍어서 확인을 해보세요..
이 경우는
예외 보니 뭐 DB조회 결과로 나온게 없는데 쓸려고 해서 out of bound exception 난거겠네요.