I am recording sensor data (accelerometer, compass,开发者_如何学运维 wifi) in Android in 5Hz frequence. I don't scan Wifi that frequently.
I am using text file. When I have 1000 data records in memory, I append them into a text file.
However this method seems quite slow. Will using a SQLite database be faster than plain text file?
One approach may be to use a double buffered list, when one queue is full, start filling the next one and in the meantime have another thread write the full queue out to disk asynchronously then clear it (and then keep repeating).
You can also experiment to easily make it triple buffered or nth buffered if you like to make faster.
精彩评论