Android的日食startManagingCursor德precated,但要支持旧的API版本? [英] Android eclipse startManagingCursor Deprecated but want to support older API versions?

查看:371
本文介绍了Android的日食startManagingCursor德precated,但要支持旧的API版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想明白了什么,我相信这是很基本的一些人。

我读无处不该startManagingCursor方法是pcated德$ P $,你应该使用CursorLoader类。但是,这是否意味着你应该使用CursorLoader类甚至支持API的级别和其中的应用程序; 11?抑或是说,如果你打算只支持蜂窝起来,然后用cursorLoader?

我似乎没有能够与API 4导入游标Loader类,所以我认为使用CursorLoader不适,直到安卓3.0+,但有人可以验证我好吗?

感谢

解决方案
  

我读无处不该startManagingCursor方法去precated,你应该使用CursorLoader类。

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

话虽这么说,德precatedAndroid中通常意味着我们将继续支持这一点,但我们认为有更好的解决方案。你当然可以使用 startManagingCursor()的API等级11+。然而,随着管理的游标的问题(特别是他们重新查询()在主应用程序线程上执行活动重新启动)仍然存在,在旧的和新的Andr​​oid版本。

  

但是,这是否意味着你应该使用CursorLoader类甚至支持API的级别和其中的应用程序; 11?

您当然可以,而且,所有其他条件相同,你也许应该。然而,一切却很少相等, FragmentActivity 要求可能是你的问题。

如果你正在开发一个新的应用程序,今天,你应该考虑的问题,从一开始的片段,在这种情况下,你会使用 FragmentActivity 无论如何,因此使用装载机不应该是一个问题。

  

我似乎没有能够与API 4导入游标Loader类

装载机的Andr​​oid的支持软件包实施工作于API级别4以上。

I am trying to understand something, and I am sure it is very basic to some people.

I read everywhere that the startManagingCursor method is deprecated and you should use the CursorLoader class. But does that mean that you should use the CursorLoader class even for apps that support API levels < 11? Or is it saying that if you intend to only support Honeycomb and up, THEN use cursorLoader?

I don't appear to be able to import the cursor loader class with api 4, so i assume that using CursorLoader doesn't apply until Android 3.0+, but can someone verify for me please?

Thanks

解决方案

I read everywhere that the startManagingCursor method is deprecated and you should use the CursorLoader class.

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.

That being said, "deprecated" in Android usually means "we will continue to support this, but we think there are better solutions". 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.

But does that mean that you should use the CursorLoader class even for apps that support API levels < 11?

You certainly can, and, all else being equal, you probably should. However, all else is rarely equal, and the FragmentActivity requirement may be a problem for you.

If you are developing a new application, today, you should be thinking about fragments from the outset, in which case you would be using FragmentActivity anyway, and therefore using Loader should not be a problem.

I don't appear to be able to import the cursor loader class with api 4

The Android Support package implementation of Loader works on API Level 4 and above.

这篇关于Android的日食startManagingCursor德precated,但要支持旧的API版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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