POJO的与光标在Android中光标、POJO、Android

由网友(无言的期待、别让我发呆)分享简介:我通常倾向于定义使用我的应用程序POJO的,如文章,评论等模型层。I usually tend to define the model layer of my apps using POJO's, such as Article, Comment, etc.我要实现我的列表视图之一的适配器的AlphabetInde...

我通常倾向于定义使用我的应用程序POJO的,如文章,评论等模型层。

I usually tend to define the model layer of my apps using POJO's, such as Article, Comment, etc.

我要实现我的列表视图之一的适配器的AlphabetIndexer。现在,该适配器接受一个收集的文章,这是我从我的身边一个SQLiteDatabase包装通常会得到。

I was about to implement an AlphabetIndexer in the adapter of one of my ListViews. Right now this adapter accepts a Collection of Articles, which I normally get from my wrapper around an SQLiteDatabase.

在AlphabetIndexer建筑工的签名如下:

The signature of the AlphabetIndexer constructer is as follows:

public AlphabetIndexer (Cursor cursor, int sortedColumnIndex, CharSequence alphabet)

由于此不接受集合或类似的东西,只是一个指针,它让我想:也许我不应该对我的模型创建对象,而只是使用游标从数据库返回

Since this doesn't accept a Collection or something similar, just a Cursor, it got me wondering: maybe I shouldn't be creating objects for my model, and just use the Cursors returned from the database?

所以在问题是,我想:我该怎么办与POJO的的集合,再present数据,或使用光标在我的应用程序,只是工作

So the question is, I guess: what should I do, represent data with Collections of POJO's, or just work with Cursors throughout my app?

任何输入?

推荐答案

我遇到了类似的问题。现在,我从POJO的抚育之遥。但是请注意,你可以创建自己的光标接口的POJO的集合,如果你选择这样做。

I have run into similar issues. Right now, I am tending away from POJOs. Note, though, that you can create your own Cursor interface for a collection of POJOs, if you so choose.

阅读全文

相关推荐

最新文章