Android的,如何使用LoaderManager和放大器;装载机与sqldatabase结合 [英] Android, How to use a LoaderManager & Loader in conjunction with sqldatabase

查看:96
本文介绍了Android的,如何使用LoaderManager和放大器;装载机与sqldatabase结合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有_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 :)

这篇关于Android的,如何使用LoaderManager和放大器;装载机与sqldatabase结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆