Difference between list and matrixcursor (Android)

非 Y 不嫁゛ 提交于 2020-01-15 12:11:20

问题


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 ?


回答1:


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

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.



来源:https://stackoverflow.com/questions/30366972/difference-between-list-and-matrixcursor-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!