在Android的蜂窝装载机 [英] Loaders in Android Honeycomb

查看:117
本文介绍了在Android的蜂窝装载机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出如何使用装载机中的Andr​​oid 3.0,但似乎无法得到它的工作。该文档只描述使用CursorLoader但我使用AsyncTaskLoader。

I'm trying to figure out how to use Loaders in Android 3.0 but can't seem to get it to work. The docs only describe using CursorLoader but I'm using AsyncTaskLoader.

从文档看来,你应该只需要实现AsyncTaskLoader.loadInBackground(),但它永远不会getLoaderManager()后调用。initLoader(),然后创建在回调装载机。

From the docs it seems that you should only need to implement AsyncTaskLoader.loadInBackground() but it never gets called after getLoaderManager().initLoader() and then creating the loader in the callback.

我可以看到调试消息称创建新的装载机的LoaderInfo {4040a828#0:ArticleDataLoader {4036b350}} 所以看起来它创建成功

I can see debug messages saying Created new loader LoaderInfo{4040a828 #0 : ArticleDataLoader{4036b350}} so it seems like it is created successfully.

难道装载机正在打破在SDK或者是有一些你需要创建加载之后调用的方法? (他们不这样做,在CursorLoader例子)。

Is it possible that loaders are currently broken in the SDK or is there some method you need to call after creating the loader? (they don't do that in the CursorLoader example).

编辑:好像调用的forceload()上的装载机从initLoader()返回开始负荷至少但这意味着你不能正确处理旋转:(

Seems like calling forceLoad() on the Loader returned from initLoader() starts the loading at least but this means you can't handle rotations correctly :(

推荐答案

戴安娜Hackborn回答的bug跟踪系统,并提到我们的静态库的实现。 CursorLoader正在做的forceload(),这就是为什么它是工作。

Dianne Hackborn replied on the bug tracker and referred us to the static library implementation. CursorLoader is doing forceLoad() which is why it is working.

有关,在大多数情况下,简单的bug跟踪系统为您处理此一类看我的附类:<一href="http://$c$c.google.com/p/android/issues/detail?id=14944">http://$c$c.google.com/p/android/issues/detail?id=14944

See my attached class for a class which handles this for you in most simple cases at the bug tracker: http://code.google.com/p/android/issues/detail?id=14944

这篇关于在Android的蜂窝装载机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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