简体   繁体   中英

copy sqlite database to Data folder

I'm creating a dictionary app. My Sqlite database is about 15MB and on the first startup I copy it to the Data folder. I do this in the onCreate Method in the main activity. While copying is in process, the user sees a black screen. I want my app to run and the user to see the main activity and only then have the database copy process start! How I can do this?

you gotta create a AsyncTask to do that, following post explains that.

http://www.androidsnippets.com/download-an-http-file-to-sdcard-with-progress-notification

Create a AsyncTask and do the work there.

It will do the copying on another thread leaving the UI thread free to interact with the user.

It is recommended that you do all heavy work outside the UI thread or your app might become unresponsive.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM