title: Android copy error from asset
body: <p>I am trying to make an application in android, by using the pre-created database. 
  I create the data file and keep it in <code>asset</code> folder, then i when the application run, it will copy to the <code>/data/data/package name/databases/data</code>
  The problem is that when i run with <code>android 2.2</code> , it copy correctly. but when i run from <code>android 2.3.3</code> over, it doesn't copy the database and also not show any errors.
  Here is my code:</p>
  
  <pre><code>public class MainActivity extends Activity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      try {
       despath="/data/data/" + getPackageName()+"/databases/data";
      File f=new File(despath);
      if(!f.exists())
     {
  
          CopyDB( getBaseContext().getAssets().open("data"),new FileOutputStream(despath));
      }
  
      } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  public void CopyDB(InputStream inputstream, OutputStream outputstream) throws IOException
  {
      byte[] buffer=new byte[1024];
      int length;
      while((length=inputstream.read(buffer))&gt;0)
      {
          outputstream.write(buffer,0,length);
      }
      inputstream.close();
      outputstream.close();
  }   
  
  }
  </code></pre>