android - copying a file from assets to databases folder data missing
<p>I have a pre-existing sqlite database that is about 5mb in size. I use this code to copy from my assets folder to the packages/databases folder on the device. </p>

<p>The database copies to the device but the data inside the database has been deleted or is missing. The only table inside is called android_metadata.</p>

<p>Here is the code:</p>

<pre><code>try{
        InputStream myInput = myContext.getAssets().open(DB_NAME);

        // Path to the just created empty db
        String outFileName = DB_PATH + DB_NAME;

        //Open the empty db as the output stream
        OutputStream myOutput = new FileOutputStream(outFileName);

        //transfer bytes from the inputfile to the outputfile
        byte[] buffer = new byte[1024];
        int length;
        while ((length = myInput.read(buffer))&gt;0){
            myOutput.write(buffer, 0, length);
        }

        //Close the streams
        myOutput.flush();
        myOutput.close();
        myInput.close();
        }catch(SQLiteException e){
</code></pre>
