I have an application that reads in a database from sqlite Database Browser it then copies the database and proceeds. However every time I change the database in sqlite Database Browser I have to uninstall and reinstall the application to copy it again. (It is just for a college assignment) On the first launch it always crashes but then works on the second. Is there anyway of avoiding this crash??Here is some of my code:\[code\] public DbH(Context context) throws IOException { super(context, DB_NAME, null, 1); this.mycontext = context;}public void createdatabase() throws IOException { boolean dbexist = checkdatabase(); if (dbexist) { System.out.println(" Database exists."); } else { this.getReadableDatabase(); try { copydatabase(); } catch (IOException e) { throw new Error("Error copying database"); } }}private boolean checkdatabase() { // SQLiteDatabase checkdb = null; boolean checkdb = false; try { String myPath = DB_PATH + DB_NAME; File dbfile = new File(myPath); checkdb = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READWRITE) != null; checkdb = dbfile.exists(); } catch (SQLiteException e) { System.out.println("Database doesn't exist"); } return checkdb;}private void copydatabase() throws IOException { InputStream myinput = mycontext.getAssets().open(DB_NAME); String outfilename = DB_PATH + DB_NAME; OutputStream myoutput = new FileOutputStream(outfilename); byte[] buffer = new byte[1024]; int length; while ((length = myinput.read(buffer)) > 0) { myoutput.write(buffer, 0, length); } myoutput.flush(); myoutput.close(); myinput.close();}public void opendatabase() throws SQLException { // Open the database String mypath = DB_PATH + DB_NAME; myDataBase = SQLiteDatabase.openDatabase(mypath, null, SQLiteDatabase.OPEN_READONLY);}public synchronized void close() { if (myDataBase != null) { myDataBase.close(); } super.close();} \[/code\]