数据已经导入数据库,接下来怎么写程序实现把数据库放入data/data/包/database下呢?
求大神指点~~

解决方案 »

  1.   

     String dbPath=android.os.Environment.getExternalStorageDirectory().getPath();
     String dbFile=dbPath+"/ourbook.db3";
      File file=new File(dbFile);
    try{
    inputStream = this.context.getResources().openRawResource(R.raw.book);
    byte[] buffer = new byte[8 * 1024];
    int readCount = -1;
    while ((readCount = inputStream.read(buffer)) > 0) {
    fos.write(buffer);}
    就是要把 book 中的东西 考到ourbook.db3中
      

  2.   

    如果仅仅是想暂时使用,可以通过eclipse里的file explorer把文件push进去就可以了如果想以后程序中一直使用,建议把sql script导出来,在OnCreate方法中执行。
      

  3.   

    typedef_god 此处省略三千字。