Using Existing sqlite Database with android ADT - android

I am developing an app in android which consists of activities that need to connect to the Database. I am having an existing sqlite DB with me. But I don't know how to include it in my project. This might be a very basic question, but as I am a newbie, I am finding it quite complex to get it working. Any help would be appreciated.

The easiest solution, by far, is to use SQLiteAssetHelper. You add one JAR to your project, package your database in a ZIP file in a specified location in your project's assets/ directory, then use SQLiteAssetHelper to access your database (much like you would use SQLiteOpenHelper).

try to read more about making a DatabaseHelper extension class
this really helped me during my first database driven app
http://www.codeproject.com/Articles/119293/Using-SQLite-Database-with-Android

The name of this feature of transfer database in android called database Ship.
I have already complete database shipUsing your own SQLite database in Android applications
Also you can see this Stackoverflow Answer

Related

SQLCipher in a ANDROID App..... trying to open DB

I have encrypted an SQLDB with SQLCipher...... in the terminal works without problem....
I am trying to open it in eclipse in an ANDROID enviroment, but without success....
I have tried all the possible examples findable on the internet without success.....
I put the database file in assets directory, is it right?
Sometimes the LogCat gives me db encrypted or is not a db and sometimes there is not such table (that I have tried to query)....
Can anyone help me?
I just would like to have an easy example, how to read and open a SQLCipher encrypted DB.
Thx
I have tried all the possible examples findable on the internet without success.
I am not aware of any examples of what you are trying to achieve.
I put the database file in assets directory, is it right?
That depends on what you are trying to do and the code that you are do it with.
My guess is that you are trying to package an encrypted database with your app, to use with SQLCipher for Android. This is useless, as anyone with the talent to get at the database will have the talent to either find your decryption key or find somebody else who can find your decryption key.
That being said, the best solution for doing this would be to port SQLiteAssetHelper to use SQLCipher for Android's classes rather than the standard SQLite classes. If you do this port yourself, you would package your database according to the SQLiteAssetHelper instructions, as a ZIP file in assets/.
I used SQLCipher in Android, but what I do is copy it to phone memory the first time and then use it as a normal SQLite database.
Is it a requirement that DB is located in assets folder?

Dragging and Dropping a SQLite database between projects

I see a sqllite database in another application, why can't I just just drag and drop from that application to mine in the eclipse environment? that way I can use data already in that database?
Android doesn't do too well with using an sqlite database file directly. Generally the way to go around it is to package an sqlite database as a resource and on first create of the app to load that resource and then connect to it and then copy all the data out of it. The downside of this is you are essentially doubling all your data.
If you are the publisher of the other app then you can list the database as a shared database to share between your apps.
Share SQLite database between 2 android apps?
Noone has written an Eclipse plugin that does that. You can write one if you feel it is both useful and worth your time.

Android App: can I use iOS sqlite? If not, how do I create a local database from a database in the cloud (Parse.com)?

I am making an Android version of an iOS app that I already have. I want to use a local database so that the user can use most the app offline.
Initally I thought I could use the sqlite database created by Core Data in Xcode, but as I am reading things online it seems like this is not possible. Is this true? Or is there a good way to export it to something Android could use?
If not, I want to create a local database with values from a database on the cloud(I use Parse.com). How can I do this? The data on the cloud doesn't change very often (maybe twice or thrice a year) if that makes any difference.
This is a good tutorial to handle preloaded databases:
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Essentially, once you have your precreated database, put it in your assets directory in your apk. Then on first app use, copy this from assets to "/data/data/YOUR_PACKAGE/databases/" directory.
You have to create the database by code in Android, using a DatabaseHelper http://developer.android.com/guide/topics/data/data-storage.html#db. If you want to use your already created database you will have to export it to SQL statements and then "import" them to your application.

How to put my DB SQLite in Android app?

Hello everyone first of all.
I am making an application for android, which I need to have a database for information.
The database management computer mailbox.
What I need is to take that database and included in the application for android'S SELECT generally.
I've been testing it on this website, but I can not get it to work. I do not think either the DB copy to memory, and then to perform the query, she says she can not find the table.
I have been debugged and saw that even the open works, but something strange happens ...
If you have some method or way of doing this, I would really appreciate it.
Thanks for everything.
Check out these resources
This tutorial by Lars Vogel
This reference article from Android website
Puit it in your assets directory in your apk, and on first use copy to "/data/data/YOUR_PACKAGE/databases/" directory. Here is SO discussion on this topic. database in assets folder

Have a Database that i got from an Iphone project (.sqlite)

What is the change that i need to do to implement an Iphone Database (.sqlite) to my android project?
Thanks for help
Android comes with SQLite3, you can either create your database from ground up or you can ship your application with a pre-populated database.
The following might prove useful:
1. SQLite Basics
2. Ship Android application with database
3. Using your own SQLite database in Android applications
Android also uses SQLite, so same DB should work.

Categories

Resources