Create SQLite Database before using it - java

I want to store some data like name and class of different students in form of SQLite database.
I want to develop an application which uses this data not fill it. I mean application should not fill it.
My application will use this data to make a report. This database should be bundled with my android app
So how to create this database on android?
How to bundle this database with the app on android?
I mean my file should be an apk but when installed it should have this database also
Please kindly give your advice
Yours Sincerely,
ChinniKrishna Kothapalli.

Basically, you need to do that :
1) Create a file containing your SQLite database into your assets folder
2) When you want to access your database, check if /data/data/yourpackage/databases/yourdatabase.db exists
3) If it doesn't exist, copy it from your assets to /data/data/yourpackage/databases/yourdatabase.db
4) Call SQLiteDatabase.openDatabase (it takes a path in parameters)

Related

Update Android App Database

So I got a simple app with a sqli database,
the app just shows the content which is saved in the database.
So if I am correct the sqli database is saved inside the app (apk),
what I am questioning myself is if I do have repeatedly upload the app / apk if I change, delete or add something in the database.
If yes is there a way around this, to like get the data from a database without repeatedly uploading the application if data has changed.
Yes, if you change something in the database you need to upload the apk, because the database is inside the apk. The alternative would be to put the database on a server. Then you would write a back end for your app in your language of choice, and this code would access the database. You could also use a Back End As a Service. Google BAAS to get info on the available options.

how to use backup database in android programming

I have been developing android application using SQLite database.
Unfortunately all content of my database got deleted by me.
but I have a database backup.
is there any possible ways to use my database?
two ways is there
1) Access the phone internal storage to push in SQLite database file
2)sqlite-database-on-your-android-emulator

Android Database access from .NET application

Hi we have an Android app that currently stores its data in xml files and are looking to move it to SQL Lite based database.
The app is a consumer of data and data is added through a windows application after the phone is connected to the PC (Currently both are done through xml files on the SD card)
If the data is stored on a SQLite database, is it possible to locate and connect to the database from a .NET application which can both enter and delete records from it.
Please advise. Thanks,
Yes. You will be able to connect and then manipulate a SQLite database from a .NET application. Use a data provider like System.Data.SQLite. The downloads are here.

iOS - Populate DB with java outside the app

I would like to write an application for iPhone/iPad which will use a database. This database is populated by a third party server so I would like to know what is the best method (SQLite,...) if I just want to drag/drop the database into my app. The database might be big so I don't think XML would be good.
What do you think?
Enable iTunes File Sharing for your app by adding UIFileSharingEnabled to it's Info.plist and setting it to YES.
Then write your app with a mock DB in place. Put the mock DB into the documents folder.
Every time you want to update your DB, simply connect your iPhone to your Mac, open iTunes, got to file sharing and drag-drop the new DB into the sharing window. This will overwrite the old DB without you needing to rebuild or reinstall.

Synchronize and Update database android application from website

I have problems.
I create an application which is on starting it will synchronize the database in external storage with database on website if any data changed it will appear dialog to ask "Do u want update".
I put my database on website http://example.com/folder/mydb.db
and for android I put it on external at data/data/database/mydb
How to check any database changed?
Change the name of the file you upload, adding the version number so you can just compare the file name to check for modification.
If different, download and override your existing DB using the tutorial here:
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

Categories