0

I am currently working with android and sqlite database. I have attached the database to eclipse like File explorer/data/data/mypackage/database.. This is working fine. But when i am attaching the database to data/sdcard to run the app on mobile.

I got the null pointer exception. No tableName Abc is found. Can anybody tell me?? Why this is happening and how can i resolve this problem???

Soorya Thomas
  • 391
  • 1
  • 8
  • 23
Narendra Pal
  • 6,474
  • 13
  • 49
  • 85

1 Answers1

3

If you want to ship your application with prebuilt database, you put it in your assets directory and on first run you copy it to /data/data/your.package/databases directory.

See https://stackoverflow.com/a/11601770/1300995 how to copy database from assets directory.

Community
  • 1
  • 1
biegleux
  • 13,179
  • 11
  • 45
  • 52