android之Activity.startManagingCursor方法详解
来源:互联网 发布:网络一线牵老年表情 编辑:程序博客网 时间:2024/06/05 11:40
在使用数据库操作查询数据后,如果是在Activity里面处理,那么很可能就会用到startManagingCursor()方法,在这里讲一下它的作用和使用注意事项.
调用这个方法,就是将获得的Cursor对象交与Activity 来管理,这样Cursor对象的生命周期便能与当前的Activity自动同步,省去了自己管理Cursor。
This method allows the activity to take care of managing the given Cursor
's lifecycle for you based on the activity's lifecycle. That is, when the activity is stopped it will automatically call Cursor.deactivate
on the given Cursor, and when it is later restarted it will callCursor.requery
for you. When the activity is destroyed, all managed Cursors will be closed automatically.If you are targeting android.os.Build.VERSION_CODES.HONEYCOMB
or later, consider instead usingLoaderManager
instead, available viagetLoaderManager()
.
Warning: Do not call Cursor.close()
on cursor obtained frommanagedQuery
, because the activity will do that for you at the appropriate time. However, if you callstopManagingCursor
on a cursor from a managed query, the systemwill not automatically close the cursor and, in that case, you must callCursor.close()
.
- android之Activity.startManagingCursor方法详解
- android之Activity.startManagingCursor方法详解
- android中Activity.startManagingCursor(cursor)方法详解
- Activity.startManagingCursor方法
- Activity.startManagingCursor方法
- Android--取得多组电话号码/Activity.startManagingCursor方法的使用
- Android之Activity详解
- startManagingCursor
- Android开发之Activity startActivityForResult()方法详解
- Android Activity的UI绘制流程之setContentView方法详解
- android startManagingCursor 出现的runtimeexcepiton
- android之 activity及activity栈详解
- Android之Activity生命周期详解
- android开发之Activity详解
- Android开发之Activity详解
- Android之旅三 Activity详解
- Android开发之:Activity生命周期详解
- android之activity的生命周期详解
- 如何避免重构带来的危险
- js 因加入form导致两个table之间出现空白问题
- Win8 Metro中文件读写删除与复制操作
- JDBC中Rowset和ResultSet的区别
- c++书籍推荐
- android之Activity.startManagingCursor方法详解
- ASSERT与VERIFY宏的区别
- Hibernate中Criteria的完整用法
- weblogic 内存 及 内存溢出
- 正则表达式语法
- iOS开发进阶之单元测试
- Android之版本更新
- HDU 4667 精度+凸包+圆切线
- GSL蒙特卡洛积分