您的位置:首页 > 产品设计 > UI/UE

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销毁...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  methods object query