Android的光标放在业务对象的通用列表? [英] Android Cursor over Generic list of business objects?

查看:88
本文介绍了Android的光标放在业务对象的通用列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在.NET中的土地,我通常会查询数据库,并填充泛型列表的集合类型。然后,应用程序将使用它。

在Android的土地我一直在阅读有关数据库访问和应用程序使用。为什么大多数的文档中使用了一个光标,使用的常量的访问呢?这是节省资源吧?

解决方案
  

这是节省资源吧?

没错。 +性能。
一般的规则是为了避免创建对象的w / o必要性,要在内存,CPU功率(并导致电池寿命)的限制和垃圾收集是相当昂贵的。

In .NET land I would normally query the database and populate a generic List kind of collection. Then the app would use this.

In Android land I have been reading about DB access and use in apps. Why do most of the docs show the use of a cursor and use of constants to access it? Is this to save on resources perhaps?

解决方案

Is this to save on resources perhaps?

Exactly. + performance.
The general rule is to avoid creating objects w/o necessity as you are limited on memory, cpu power (and resulting battery life) and garbage collection is rather expensive.

这篇关于Android的光标放在业务对象的通用列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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