Re: ORMLite and ListViews on Android

484 views
Skip to first unread message

candrews

unread,
Aug 9, 2012, 2:37:30 PM8/9/12
to ormlit...@googlegroups.com, ormlite...@googlegroups.com
I posted some code a while back for just this problem:
https://groups.google.com/forum/?fromgroups#!searchin/ormlite-android/OrmLiteSimpleCursorAdapter/ormlite-android/P0LNbOXd2bM/Vjgqk9aHKsIJ

There are also a few more topics which are relevant:
https://groups.google.com/forum/?fromgroups#!topic/ormlite-android/5sXxF3f9MYc[1-25]

https://groups.google.com/forum/?fromgroups#!topic/ormlite-user/SbRoHIov5pI[1-25]

This topic comes up every once in a while, but nothing is in ORMLite
itself. It's certainly doable... The code from my post (the first link)
is used in the MOTOACTV Android app and I haven't seen or heard of any
issues with it.

~Craig

BTW - This question probably best belongs under the Android group;
copying that list.

On 09.08.2012 14:24, Michael Burton wrote:
> I'm evaluating ORMs for a major Android app and one question I
> haven't
> been able to answer yet is best practices concerning ORMLite and
> Android ListViews.
>
> Most of the ORMLite examples I've found online load all of the DAO
> objects into an ArrayAdapter to iterate over. I'm sure this is fast,
> but it's simply not tenable for lists involving large numbers of
> objects considering a phone's limited heapsize.
>
> Android best practices generally use dynamically loading listview
> adapters that read their data from their source a row at a time
> rather
> than all at once. Are there examples of how to do this using ORMLite?
> Is this desirable using ORMLite, or does the performance overhead
> make
> the listview view inflation too sluggish?
>
> Cheers,
> Mike

Michael Burton

unread,
Aug 10, 2012, 2:37:59 AM8/10/12
to ormlite...@googlegroups.com, ormlit...@googlegroups.com
Thanks Craig!  

In your opinion, how does the performance of ORMLite feel in a ListView?  Does it feel snappy?  Have you done any performance comparisons against not using an ORM?

Cheers,
Mike

candrews

unread,
Aug 10, 2012, 11:09:35 AM8/10/12
to ormlite...@googlegroups.com
ORMLite performed very well for me. As long as the normal rules for
database development are followed (proper indexes, select only columns
you want, etc), I didn't have any problems. Specifically for the
ListView, the code I used performed well for my use case. The improved
maintainability and ease of development when using ORMLite versus not
using an ORM made it a clear winner.

~Craig

On 10.08.2012 02:37, Michael Burton wrote:
> Thanks Craig!
>
> In your opinion, how does the performance of ORMLite feel in a
> ListView? Does it feel snappy? Have you done any performance
> comparisons against not using an ORM?
>
> Cheers,
> Mike
>
> On Thursday, August 9, 2012 11:37:30 AM UTC-7, candrews wrote:
>
>> I posted some code a while back for just this problem:
>>
>
> https://groups.google.com/forum/?fromgroups#!searchin/ormlite-android/OrmLiteSimpleCursorAdapter/ormlite-android/P0LNbOXd2bM/Vjgqk9aHKsIJ
>> [1]
>>
>> There are also a few more topics which are relevant:
>>
>
> https://groups.google.com/forum/?fromgroups#!topic/ormlite-android/5sXxF3f9MYc[1-25]
>> [2]
>>
>>
>
> https://groups.google.com/forum/?fromgroups#!topic/ormlite-user/SbRoHIov5pI[1-25]
>> [3]
> Links:
> ------
> [1]
>
> https://groups.google.com/forum/?fromgroups#!searchin/ormlite-android/OrmLiteSimpleCursorAdapter/ormlite-android/P0LNbOXd2bM/Vjgqk9aHKsIJ
> [2]
>
> https://groups.google.com/forum/?fromgroups#!topic/ormlite-android/5sXxF3f9MYc[1-25]
> [3]
>
> https://groups.google.com/forum/?fromgroups#!topic/ormlite-user/SbRoHIov5pI[1-25]

glenviewjeff

unread,
Aug 10, 2012, 5:50:06 PM8/10/12
to ormlit...@googlegroups.com, ormlite...@googlegroups.com
Mike,

I've been using OrmLite for a couple of years now and have found performance not to be an issue at all.  And hopefully based on our past RoboGuice discussions, that should mean something :)

I highly recommend it; though I don't know of any real alternatives.  Gray has been quite helpful and even recently added in a snapshot release (indirect) support for Guice injection of objects pulled from the database.

Jeff
Reply all
Reply to author
Forward
0 new messages