Need Help in SQLite database for Android
-
I m developing data Entry type of Application. in this i'm having database problem. when i upload the App to mobile and run, it run's normally but when i restart the Mobile all the data from database is removed.. what should i do to save the data permanently.
-
I m developing data Entry type of Application. in this i'm having database problem. when i upload the App to mobile and run, it run's normally but when i restart the Mobile all the data from database is removed.. what should i do to save the data permanently.
If you are using SQLiteOpenHelper object then database will be permanent.Two helper methods onCreate (To create DB when it does not exists) and onUpdate (used when db exists but has different version) are available. Refer http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html[^] to know more about SQLiteOpenHelper.
-
I m developing data Entry type of Application. in this i'm having database problem. when i upload the App to mobile and run, it run's normally but when i restart the Mobile all the data from database is removed.. what should i do to save the data permanently.
Hello, I had the same problem. Please see my code and description below: Data base initialization:
private SQLiteDatabase _mySqlLiteDataBase = MyActivity.this.openOrCreateDatabase("MyDataBaseName", Context.MODE_PRIVATE, null);
Please note that method name is: openOrCreateDatabase. This mean that it will only create your database if it does not exists. Hope this will help.