SQLiteOpenHelper problem...

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

SQLiteOpenHelper problem...

Postby WhiteTigerK » Wed Oct 28, 2009 12:12 am

Hi,

I'm having an annoying problem with a SQLiteOpenHelper.
In my application i have a database with 2 tables. I've implemented a content provider for performing any type of database action against those tables, and a SQLiteOpenHelper to manage the database itself.

When i launch the application for the first time, the onCreate() method of the ContentProvider is being called (even before the activity is initialized, which i find very strange, but that doesn't matter at the moment) and there i'm getting a context object by calling getContext(), creates the SQLiteOpenHelper object and gets the database from it (which causes the onCreate() method of the SQLiteOpenHelper to be called since the database needs to be created).

Everything works just fine. I even succeed to enter data into the table, and even to query the data.

My problem begins when i'm launching the application at the second time. Although the database has been created in the first application launch, and data was inserted to database's table successfully (i've managed to query as i said), the onCreate() method of the SQLiteOpenHelper is being called again. It's like the database was not "saved" into the virtual device (i'm working on Emulator for now).

If someone has some sort of idea why this can happen, please tell me...

10x
WhiteTigerK
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Oct 05, 2009 5:54 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 5 guests