Pravin Mohol
Pravin Mohol

Reputation: 675

Android SqliteDatabase- How to create 40 tables at once in Android ? any better and faster option?

I have requirement that I want to Create more than 40 tables when app is first time installing in android device. Can anybody help me how to implement this approach?

Thanks in Advance !!

Pravin

Upvotes: 0

Views: 50

Answers (2)

CommonsWare
CommonsWare

Reputation: 1007534

Option #1: Use SQLiteAssetHelper to package a database with your app that contains 40 tables.

Option #2: Use SQLiteOpenHelper and create your 40 tables in onCreate().

In either case, as Toon Borgers notes, you need to ensure that you open your database on a background thread, whether via AsyncTask or some other means.

Upvotes: 3

Toon Borgers
Toon Borgers

Reputation: 3658

I'd definitely run it in an AsyncTask, so you don't block the UI thread. Maybe try to find a way to do it in parallel (search for tables that don't depend on each other)

Upvotes: 0

Related Questions