-1

I am using Mozila extension SQLite Manager to create a database and use it in my app.
I created a table named test.

enter image description here

enter image description here

Then I read the data using the following line and it succeed.

My question is: "testing" should be the name of table right?
But when I use "select * from test" it reads nothing.
Initially I named the table as "testing".

Cursor cursor=dbHelper.QueryData("select * from testing");
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Sam
  • 1,252
  • 5
  • 20
  • 43
  • does the created table contains any rows/columns? – Mujammil Ahamed Aug 02 '16 at 07:00
  • @MujammilAhamed I attached the content of the table – Sam Aug 02 '16 at 08:15
  • @Rotwang: whilst the linked duplicate might be *related*, it is by no definition of the word *duplicate*, an actual duplicate. – Matt Aug 12 '16 at 12:05
  • @Matt But the OP is (**indirectly**, I must admit) asking how to ship a prepopulated database in his/her app... or I don't see how could s/he use it in his/her app. Therefore, I went **one step beyond** and marked the post as a duplicate. But I agree, it's not a **straight** duplicate. – Phantômaxx Aug 12 '16 at 12:08
  • 1
    @Rotwang: in these cases, adding an answer to "join the dots" then adding a link to the *related* question would be acceptable. – Matt Aug 13 '16 at 09:50

1 Answers1

0

It seems that you are indeed asking how to ship a prepopulated database in your app - or I don't see how could you use it in your app.

Now the steps are very simple:
1. If not already existing, copy the database from the assets folder to the data path.
2. Use it from there.

You will find some related posts on SO. For instance: here and here

Now, if you changed your table name (!!), you must respect the new table name.
The new database must be copied in the assets folder, but the old database now must be removed from the the data path.

This is because otherwise the app will find the database and won't copy the new one over it.

Which is the desired behaviour: you don't want your app to copy the database each time it starts, but only once - since it's a time consuming operation.

Community
  • 1
  • 1
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115