I have a class derived from SQLiteOpenHelper which is all about working with a database, i.e. tables creation, insertions, data selections. All methods which deal with data selection return a Cursor. What I really want is to get a list of objects rather than a cursor, at the same time I don't want my class to do a lot of things. Is it a good idea to add another class who get selections from a database and construct objects from the selection? Thank you.

1 Answer 1


One pattern you should look into is the Repository pattern. Nice example here. There will be many others out there on the web.

The Repository pattern compliments your database access and allows you to define queries and return result items as the objects you want.

You create your domain object like User and return that object type from the repository.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.