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.
            Asked
            
        
        
            Active
            
        
            Viewed 1.4k times
        
    2 Answers
14
            
            
        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.
        GeekYouUp
        
- 1,651
 - 11
 - 10
 
- 
                    How to avoid second step and make the copying process to run only once instead on performing each time? We can place a check condition to verify the db presence but is there any other way like creating at the time of installation? – Yogi May 18 '17 at 11:42
 
0
            
            
        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
        Community
        
- 1
 - 1
 
        Jaydeep Khamar
        
- 5,975
 - 3
 - 32
 - 30