安卓:什么是德precating startManagingCursor的原因是什么? [英] Android: What is the reason for deprecating startManagingCursor?

查看:154
本文介绍了安卓:什么是德precating startManagingCursor的原因是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是德precating startManagingCursor的原因是什么?

What is the reason for deprecating startManagingCursor ?

我的简单的应用程序与从DB数据的列表中选择一个表视图。所以,我现在在的onCreate:

My simple app has a table view with list of data from DB. So, what I have now in onCreate:

 final Cursor cursor = getDataFromDB();
 startManagingCursor(cursor);
 setListAdapter(new CursorAdapter(cursor));

和多数民众赞成它,我不需要做别的事......

And thats it, and I dont need to do anything else...

但startManagingCursor是德$ P $现在pcated,我应该实现LoaderCallbacks,覆盖onCreateLoader,onLoadFinished,onLoaderReset,创建ContentProvider的FO我的数据库等。但我不需要这一切的工作人员,我只需要获得来自DB几行信息。怎样成为 ?机器人为什么这样做?我为什么要实现这一切的工作人员?

But startManagingCursor is deprecated now, and I should implement LoaderCallbacks , override onCreateLoader, onLoadFinished, onLoaderReset, create ContentProvider fo my DB and so on. But I dont need all this staff, I just need to get few lines of information from DB. How to be ? Why android did that ? Why should I implement all this staff ?

推荐答案

话虽这么说,在Android的pcated德$ P $通常意味着我们将继续支持这一点,但我们认为有更好的解决方案。

That being said, "deprecated" in Android usually means "we will continue to support this, but we think there are better solutions".

如果你愿意从FragmentActivity继承,您可以使用Loader框架实现在Android支持包,将所有的方式回到了Android 1.6。

If you are willing to inherit from FragmentActivity, you can use the Loader framework implementation in the Android Support package, going all the way back to Android 1.6.

您当然可以在API级别11+使用startManagingCursor()。然而,管理游标(特别是他们重新查询()在主应用程序线程上的活动重新启动)的问题依然存在,在旧的和新的Andr​​oid版本。

You can certainly use startManagingCursor() on API Level 11+. However, the problems with managed cursors (notably that they requery() on an activity restart on the main application thread) are still there, on older and newer Android versions.

来源:<一href="http://stackoverflow.com/questions/9771582/android-eclipse-startmanagingcursor-de$p$pcated-but-want-to-support-older-api-ver">Android日食pcated startManagingCursor德$ P $,但要支持旧的API版本?

这篇关于安卓:什么是德precating startManagingCursor的原因是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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