getContentResolver().query 和 managedQuery 的区别
2011-12-20 14:38
435 查看
managedQuery ——》android.app.Activity.managedQuery
query ——》android.content.ContentResolver.query
To query a content provider, you can use either the ContentResolver.query() method
or the Activity.managedQuery() method. Both methods take the same set of arguments, and both return a Cursor object. However, managedQuery() causes the activity to manage the life cycle of the Cursor. A managed Cursor handles all of the niceties, such as unloading
itself when the activity pauses, and requerying itself when the activity restarts. You can ask an Activity to begin managing an unmanaged Cursor object for you by calling Activity.startManagingCursor().
重点这句: However,
managedQuery() causes the activity to manage the life cycle of the Cursor. 产生的游标的生命周期和当前activity关联,activity销毁,Cursor销毁...
query ——》android.content.ContentResolver.query
To query a content provider, you can use either the ContentResolver.query() method
or the Activity.managedQuery() method. Both methods take the same set of arguments, and both return a Cursor object. However, managedQuery() causes the activity to manage the life cycle of the Cursor. A managed Cursor handles all of the niceties, such as unloading
itself when the activity pauses, and requerying itself when the activity restarts. You can ask an Activity to begin managing an unmanaged Cursor object for you by calling Activity.startManagingCursor().
重点这句: However,
managedQuery() causes the activity to manage the life cycle of the Cursor. 产生的游标的生命周期和当前activity关联,activity销毁,Cursor销毁...
相关文章推荐
- getContentResolver().query 和 managedQuery 的区别
- getContentResolver.query 和 managedQuery 的区别
- getContentResolver().query 和 managedQuery 的区别
- managedQuery 和 getContentResolver().query的区别
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- Context.managedQuery()和context.getContentResolver()获取Cursor关闭注意事项
- android 取相册 图片 getContentResolver().query 返回空。
- 怎么用getContentResolver().query读取手机短信
- context.getContentResolver().query()详细用法详解
- 在执行context.getContentResolver.query()方法时出现错误。
- 怎么用getContentResolver().query读取手机短信
- getContentResolver().query()方法selection参数使用详解(转)
- Android开发如何在getContentResolver().query()方法中实现结果去重