Data not displayed first time in android after copying the file from assets to data folder
Posted
by Thinkcomplete
on Stack Overflow
See other posts from Stack Overflow
or by Thinkcomplete
Published on 2010-06-02T07:10:51Z
Indexed on
2010/06/02
7:24 UTC
Read the original article
Hit count: 265
Description I have used the code tip from http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ to copy a pre-filled data file to the target and handled this in a asynch task
Problem : On starting the application it gives error and shuts down first time, starting again without any change it works perfectly fine. So first time after the file is copied, the error comes but after that no issues. Please help
Code attached:..
private class CopyDatabase extends AsyncTask<String, Void, Boolean> {
private final ProgressDialog dialog = new ProgressDialog(BabyNames.this);
protected void onPreExecute() {
this.dialog.setMessage("Loading...");
this.dialog.show();
}
@Override
protected Boolean doInBackground(String... params) {
// TODO Auto-generated method stub
try {
namesDBSQLHelper.createDatabase();
return null;
} catch(IOException ioe){
ioe.printStackTrace();
}
return null;
}
protected void onPostExecute(final Boolean success){
if (this.dialog.isShowing()){
this.dialog.dismiss();
}
}
}
© Stack Overflow or respective owner