When I create an SQlite Database I dont find it in resources of my android project so I want to locolize it in my hard disk , and how to proceed to open it ?
You can't directly save your database into harddisk But you can create database in sdcard
then copy that database from sdcard to your harddisk.
Then you can access that database using SQLite Database browser
You have to do some selection from your database to see all records
here is a tutorial that can help you
Related
Say I have data about customers and I initially have around 1000 pre-determined customers details I want to insert into my SQLiteDatabase.
Would it be wise to store that data into a text file in my assets folder with my own formatting (tabs to indicate columns and new lines to indicate rows), then just read the text file and insert the data into the database with insert statements? I feel this is not the best way and very in-efficient.
Is there a better way of doing this?
You can use the utility to create your SQL Lite database offline on PC, such as this:
http://portableapps.com/apps/development/sqlite_database_browser_portable
You can package this database along with your app and then put it on phone storage and continue from there.
You can do do in two ways..
Way 1:
You can make one .sqlite file with already 1000 customer records inserted in database and you can use it that .sqlite file from assets folder. Then you can copy those records in your internal database or use that only database.
Way 2:
You can put this 1000 records on server and call it by web service at first time app is launched..
Hope it will help you.
User a .sqlite or .db file in your assets folder with prelaoded entries and import this file to you app from asset folder.
You can use this add-on to access and create you db file
https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/
and this is tutorial to access database file from assets
Android: Accessing assets folder sqlite database file with .sqlite extension
I would bring along the already pre-populated database .db file.
I've done this before with "sample" data included as part of an application.
I have already SQLite manager in the file explorer but here I can view only database structure and browse data means see data of table and I can not insert ,delete and update data. so I want do CRUD operation for database table. Can i add
SQLite browser in eslipse?.
Please Can anybody suggest me.
Thanking you
You have to paste the db file into assets folder. Then you can able to do CRUD operation:)
i have to create a DIRECTORY in a database in which a few file will store.when user need any kind of file, the file fetches from that directory .
You can't cerate a directory in an sqlite database.
Either you create a directory on the filesystem using File.mkdir.
Or you create a table in a sqlite database. Here's a good tutorial.
There is no way to make directories in sqlite db.
Use android provided api for data storage read this tutorial.
Please first read about databases & then try to use it!!
Database:
A database is an organized collection of data, today typically in digital form.
Directory:
A directory or folder is nothing more than a location on a disk used for storing information about files.
I have created an sqlite databse and put it into the assets folder. How can I access it? I have created a database helper class also, but my data is "not taking the path".
Plz help me
Thanks
Copy your database file from /asset to internal databases directory /data/data/<package_name>/databases/, then use that database file.
Look at this SO question How to ship an Android application with a database?.
Also this tutorial Using your own SQLite database in Android applications
I am having Registration screen as my first screen but before that i want to create database. is it possible to create database at time of installation in android rather than creating in first activity.
This is a great article that helps http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Create the sqlite db using SQLite Database Browser and store it in your assests folder
When app launches, copy the db from assets to your apps data directory
Open the DB
This way you don't have to parse csv files or dynamically create the db on the device, saving time during first load.
If you want to use a previously created database in your application,at the time of installation the you need to create a database put it in assets folder and then copy it in application.
refer this links:
SQLite Database "context" passed to adapter
Database not copying from assets
adding your own SQLite database to an android application