我有_id等数据库。
我想通过一个LoaderManager和放大器来加载此数据;加载到适配器,但我不知道怎么样。
I want to load this data via a LoaderManager & Loader to an adapter but I'm not sure how.
任何人都可以解释为使用LoaderManager及放一个简单而有效的方法;装载机与sqldatabase?
Can anyone explain an easy yet efficient way to use a LoaderManager & loader with an sqldatabase ?
感谢你。
我发现要使用的最好的方式 AsyncTaskLoader
中的本教程在Android设计模式的博客。这个例子返回 SampleItem
对象,但它不会是很大的端口code返回光标
然后执行在 loadInBackground
法的数据库查询。
The nicest way I've found to use the AsyncTaskLoader
has been detailed in this tutorial on the Android Design Patterns blog. This example is returning a SampleItem
object but it wouldn't be much to port the code to return a Cursor
and then perform the database query in the loadInBackground
method.
我全力推荐你通过系列的所有部分读,这是一个良好的阅读:)
I thoroughly recommend you have a read through all the parts of the series, it's a good read :)