本文介绍了列表和matrixcursor之差(Android版)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我在其中收集从网上JSON文件我的数据一个新的Andr​​oid项目。
如果我期待在互联网上,我可以看到很多在那里它们被存储在MatrixCursor收集的数据的例子。
就个人而言,我觉得它更容易(和更短/快)的所有数据存储在一个模型类的列表。
有没有为什么他们不使用列表,而不是MatrixCursor一个很好的理由,或者它们之间有什么区别呢?

I'm trying to make a new android project in which I collect my data from an online JSON file.If I look on the internet, I can see a lot of examples where they are storing the collected data in a MatrixCursor. Personally, I think it's much easier (and much shorter/faster) to store all the data in a list in a model class. Is there a good reason why they are not using Lists instead of MatrixCursor, or what are the differences between them ?

推荐答案

我也preFER有可以从JSON数据与自定义创建沿着模型类 ListAdapter 这些类。

I also prefer to have model classes that can be created from JSON data along with a custom ListAdapter for those classes.

不过,也有组件,如搜索查看明确要求在的CursorAdapter 即用于搜索建议。在这些情况下。它更容易把数据放到像光标 MatrixCursor ,传递到 SimpleCursorAdapter ,并用它做。

However, there are components such as SearchView that specifically require a CursorAdapter i.e. for search suggestions. In those cases. it's easier to put the data into a cursor like a MatrixCursor, pass that to a SimpleCursorAdapter and be done with it.

这篇关于列表和matrixcursor之差(Android版)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 11:23