1

I have an android application which is actually an indoor positioning system, using a SQLite Database. When the user opens the app, he has to calibrate it first. That is, scan position in the venue then app records rssi x,y values in a sqlite database THEN it shows the user's position. However when i exit the app, and open it again, i have to go through the whole process of calibration.

The data is deleted from the database which forces the user to re-calibrate it every time he/she starts the application. Anyone can help me prevent the deletion of the records please ? Thank you.

Lakshay
  • 11
  • 2

2 Answers2

0

This is because it is a short lived object. When you close your application,that object is recycled in the onStop method of the activity. If I were you, I would consider storing the calibration settings in either a SQLite DB or in the shared preferences DB so the user does not need to constantly recalibrate. The implementation really depends on what needs to be stored for the device to be calibrated.

This link should help explain activity lifecycles:

http://developer.android.com/training/basics/activity-lifecycle/index.html

http://developer.android.com/training/basics/activity-lifecycle/stopping.html

Alexander N.
  • 1,458
  • 14
  • 25
0

You'll need to override the Method onSavedInstanceState() method.

Please see this question, where that is described in detail.

Community
  • 1
  • 1
Zach Olivare
  • 3,805
  • 3
  • 32
  • 45