POJO's versus Cursors in Android

Posted by Kilnr on Stack Overflow See other posts from Stack Overflow or by Kilnr
Published on 2010-03-30T12:34:49Z Indexed on 2010/03/30 14:13 UTC
Read the original article Hit count: 591

Filed under:
|
|
|

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

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.

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?

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?

Any input?

© Stack Overflow or respective owner

Related posts about android

Related posts about best-practices