How do I transfer a database from SQLiteStudio to an Android phone? - android

I have created a database in SQLiteStudio. The database consists of a single table, with columns 'Name', 'Age' and 'Occupation', and several rows of data.
I want to transfer that database from SQLiteStudio to an Android phone. How would I do this?

Well, the simplest way if there are only a few rows would probably be to create the schema and populate it in SQLiteOpenHelper.onCreate(db) using SQL statements executed with db.execSQL().
If you would like to avoid that however, and just directly take the database that you've created externally over into your app, you could look into Android SQLiteAssetHelper

Yes, the Android SQLiteAssetHelper is really simple compared to other guides that uses hundred of lines with codes. Tried numerous guide and tutorials before I found out about that helper. Here is a really simple guide to follow where he's using it and explains it pretty good.
Import and use external database in Android

Related

How to use SQL Database other means of Data Storage

I have a SQL Database containing 24 Columns and about 24000 Rows. I want to retrieve data from that SQL Database. I am new to Android and don't know how to use it.
I found an Android library called Realm but I couldn't find a way of Converting SQL to Realm Database.
If there is a simple way to read data from and to store data in SQL Database or another way of storing data in Android in form of Database, please let me know.Any Help will be appreciated.
Thanks!!
android uses SQLite. This is very similar to SQL. You would only need to have the app download the data from the server database and copy in into the local database.
SQLite information can be found at http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html
Converting from an SQL file has been discussed at Convert MySQL to SQlite
Android comes with SQLite, this is what you should use. did you search anything like "Android and sql"? android training on the subject
Edit:
so you dont have an sql file, you have an online MySql database. can use jdbc but it is not widely recomended. there are some alternatives as in here and here
Not sure if this will help, but . . .
I have been playing around with different programming options for my Android tablet. One is RFO Basic! freely available from the Google store. It seems to be a dialect of Dartmouth Basic with a lot of built-in hooks to Android specific functions (GPS, camera, etc) as well as an interface to SQL. The set of example programs that comes with the distribution includes and SQL example.
Being a Basic-language environment it will (1) be easy to learn but (2) probably slow (very slow) on a 24000 row table..
Hope this helps

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.

Sharing same SQLite DB for two android apps

I would like to maintain single sqlite DB for two applications. I have seen other links and this was helpful Share SQLite database between 2 android apps?
But still when I declare the shared user ID and shared context, I could not achieve it.
In my first app- SQLite is created with few tables.
In my second app=- I would to create tables in the same DB which I created in first app
And also in few posts, I read that this can be achieved through remote Database.
Please can some one suggest me good tutorial where I can have some idea on how to proceed?
I would recommend what you've asked about - which is using a remote database.
Check out this: how to use free cloud database with android app?
Look into a hosted database in the cloud. Quite a few of them will let you get started for free. I know IrisCouch lets you get going for free and it's very easy. http://www.iriscouch.com/ The nice thing about CouchDB is you can do all your work via HTTP - which isn't too hard from an Android device.

Making a database helper class for a table with many fields

I'm currently trying to learn how to use a SQLite database with android. I've managed to successfully follow http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/ but I'm now looking to make a table with 25-30 fields. It seems like it would be a huge task to type out all this in a similar style to that link especially as I'd want to be able to search by many of those fields.
Is there something I can use to automatically generate a database helper class with this number of fields and methods to search them? Or am I going about this completely the wrong way?
Thanks
First off i just recently started android programming also and i particularly enjoyed this tutorial about databases : http://www.vogella.de/articles/AndroidSQLite/article.html
To generate the queries i think it will be better you use an SQLite Database Manager and just copy and past your queries in the methods.

What kind of database is used in Android document call functions?

Okay, so I am still learning to do some coding here, and I seem to have gotten stuck.
I want to have a select number of documents added to a package for the Android OS
but I don't know how to store said documents. Do I add them all under res/raw, or make an SQLite database and call from there?
More importantly, I need to be able to call those documents when a search criteria is added.
I was on the Android reference site, and they add write functions for the SQLite db, which I would prefer not having as an option.
What kind of database should I implement here?
I would prefer a link to an example, but anything would help at this point.
Try reading this.
Notepad example
or make an SQLlite database and call from there?
No you don't create a SQLlite database it will be created for you after your App start the database call.
See this SQLiteOpenHelper
And SQLiteDatabase

Categories

Resources