1

I would like to get some help with my problem. Here are the details:

  • Android application.
  • Connected to a sensor (Zephyr Bioharness) via bluetooth.
  • Receive and save the values (250 values/sec) for 2 minutes (demo purposes).
  • Storage the values on the database with ORMLite.
  • Read them all (queryForAll()) in order to create a JSON.
  • The application crashes.

In the future it may be saving values for 30 minutes, so it's a problem we must solve in an efficient way.

My only idea is reading the values by blocks. Can I do that with ORMLite ?

In case you have a better solution, it will be also appreciated.

Thank you in advance.

Heshan Sandeepa
  • 3,388
  • 2
  • 35
  • 45
UDKOX
  • 738
  • 3
  • 15
  • 1
    not using ORMs at all ... plain Cursor + streaming JSON API – Selvin Mar 16 '15 at 16:25
  • Not posible. This app has been developed for 3 years and we can't change it's database structure now. – UDKOX Mar 16 '15 at 16:37
  • 1
    well, seems like you choose bad technology for this ... I have no problems with 30K or more rows with ContentProvider and plain Cursor(10K rows in ListView, yeah,showing so much data is usless, but, still no problems) ... anyway try http://stackoverflow.com/questions/7811466/ormlite-dao-in-android-getting-really-slow-when-querying-more-than-few-thousand point 2 ... IMHO ORM/POJOs are a bad for more than 1000 items – Selvin Mar 16 '15 at 16:42
  • 1
    *Of course* you should not try to read all the entries into memory at once - even if it works for some dataset size, there will be another for which it may fail. Send them in batches, and keep in mind that the network connectivity of an Android device may come and go, so try to choose a mechanism where you can resume after the last successful batch (rather than start over) if you have a transmission failure at some point. – Chris Stratton Mar 16 '15 at 17:19

0 Answers0