Skip to content Skip to sidebar Skip to footer

Would You Like To Integrate A Pojo- Or Cursor-based Library In Your Android App?

My company wants to publish a library for android, so that other people can integrate our content easily in their custom apps. Now I am still very uncertain how I should provide th

Solution 1:

We used the Cursor approach in our last project, and found it quite cumbersome. Especially having to check whether there's actually something in the Cursor, iterating over it, finding the right indices for values, closing it properly.. not something I like to do over and over again. Especially the whole index stuff tends to break quite easily, especially since you can't define constants for it if you're actually making use of projections.

A good approach would probably be to use Cursor backed POJOs, at least when it comes to collections. That way the data could be read on demand. You still would have to find a sensible way to close the cursor then, though.

In case of single objects, I say to hell with projections and just dump everything it into a POJO.


Post a Comment for "Would You Like To Integrate A Pojo- Or Cursor-based Library In Your Android App?"