I have used the code tip from here to copy a pre-filled data file to the target and handled this in a asynch task.
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.
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();
}
}
}