1

Android: How to save sensor data onSensorChanged to a database?

view story
linux-howto

http://stackoverflow.com – I'm writting an android app in which I'm acquiring the accelerometer data from the sensor of the phone until the user quits. Afterwards I modify the data and try to save it to an existent database. Everything works fine, but when I'm calling my saveToDatabase() method in the onSensorChanged method, then the app starts to work extremely slow and becomes unresponsive and crashes shortly after. So, the problem is that i'm calling saveToDatabase() too often... Is there a way to avoid that? May be with an ArrayList/LinkedList/ArrayDeque where the sensor data have to be collected and after 5mins (HowTos)