【发布时间】:2011-05-07 20:34:41
【问题描述】:
我应该使用以下哪两个来确保所有游标都已关闭?
Cursor c = getCursor();
if(c!=null && c.getCount()>0){
try{
// read values from cursor
}catch(..){}
finally{
c.close();
}
}//end if
或
Cursor c = getCursor();
try{
if(c!=null && c.getCount()>0){
// read values from cursor
}//end if
}catch(..){
}finally{
c.close();
}
请指教。
【问题讨论】:
标签: android sqlite android-cursor