tags:

views:

777

answers:

5

i use a existed slqite database, and copy it to /data/data/packagename/databases,

The code learned from this blog:

http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

after copy the database, I open the databse. But the log message show the error:

No such table android_metadata

So i need creat a table named android_metadata? And what the value i need insert into this database

Thanks very much

+1  A: 

I am already using as given in that link for a long time..

It works.. Checkout your DB again the table created or not ?

I prefer to install SQLite Manager plugin in firefox for sqlite database operation.. after completing all process as mentioned in the same link..

Checkout http://www.devx.com/wireless/Article/40842/1954.

It contains all database operations.

Vishal
A: 

The question is this database is already exist.So i just copy this database to system folder.

I don't have a table named android_metadata. And i also did not use this name to get data.

So what the problem?

The android system need each database should have a table android_metadata?

this should be a comment
Janusz
+3  A: 

Actually, with a bit more reading, I have discovered that I need to use the SQLiteDatabase.NO_LOCALIZED_COLLATORS flag when calling SQLiteDatabase.openDatabase() - this no longer causes the problem.

foryou
+2  A: 

It seems that for some reason android requires every database to have a table called android_metadata that includes at least one locale. The reigndesign blog you mentioned tells you how to create the table and prefill it with a locale.

Check if your database contains this table and if the table has some content.

Janusz
A: 

@foryou: I was trying your solution but problem still remain, So i think used flag SQLiteDatabase.NO_LOCALIZED_COLLATORS is not solve this problem.

App can't not start when this bug happen, to start app again user must remove app and clear all data.

To avoid issue can't start app when this bug happen, in create and update method i initialize android_metadata table.

@After search in google i was discover this bug happen in iphone too.

nguyendat