query = "select ser_no _id, * from " + mcApp.search_p +" where ser_no = 0 order by priority";
mListView=(ListView)findViewById(R.id.list_product);
mHelper=new ProductDBHelper(this);
db=mHelper.getReadableDatabase();
cursor=db.rawQuery(query,null);
startManagingCursor(cursor);
//리스트뷰에 각 텍스트 매칭
AdapterProduct=new productAdapter(mListView.getContext(), R.layout.page_list_listview, cursor,
new String[]{"m_name", "tag_line", "detail_img"},new int[]{R.id.toptext, R.id.bottomtext});
mListView.setAdapter(AdapterProduct);
위와 같이 디비에서 정보를 받아오고 있습니다.
정상적으로 동작하는 코드구요.
듣기로는, 디비 close를 해주지 않으면 메모리 누수가 발생할 수 있다하네요.
근데 위의 소스에서 딱히 디비를 open한다는 명령을 하지 않았는데
디비를 close해주어야 하나요?
해주어야 한다면 어디서 close해주어야 하나요??
조언부탁드립니다.^^
커서어댑터가 다 좋은데 커서를 직접쓰기 때문에 DB close 타이밍이 참 안나오는게 단점이죠...
db leak 오류 나게 만드는거 일도 아니구요.... ㅡㅡㅋ
아니면 cursor의 데이터를 ArrayList에 옮겨 담고 cursor와 db를 다 닫아버리고 ArrayList만 사용하는 방법도 많이 쓰구요...




getReadableDatabase
이거 자체가 db를 읽기전용으로 열었다는건데용.. ㅡ,.ㅡ;;
그리고 close는 데이터 다 받아오시면 닫아주심됩니다...