2015百度推广网站遭到攻击,非遗网页设计作品欣赏,网站建设的价值是什么,北京建设银行支行查询官方网站我看过几篇关于如何在android中导入和导出数据库的帖子,我找到了这些代码,但我似乎无法使它工作.我收到错误java.io.filenotfoundexception / storage / sdcard0 / BackupFolder / DatabaseName#xff1a;打开失败的ENOENT(没有这样的文件或目录).我改变了一些东西,但我仍然没…我看过几篇关于如何在android中导入和导出数据库的帖子,我找到了这些代码,但我似乎无法使它工作.我收到错误java.io.filenotfoundexception / storage / sdcard0 / BackupFolder / DatabaseName打开失败的ENOENT(没有这样的文件或目录).我改变了一些东西,但我仍然没有找到文件异常这是我的出口private void exportDB() {try {db.open();File newFile new File(/sdcard/myexport);InputStream input new FileInputStream(/data/data/com.example.mycarfuel/databases/MyDatabase);OutputStream output new FileOutputStream(newFile);byte[] buffer new byte[1024];int length;while ((length input.read(buffer)) 0) {output.write(buffer, 0, length);}output.flush();output.close();input.close();db.close();} catch (FileNotFoundException e1) {// TODO Auto-generated catch blocke1.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}和我的导入private void importDB() {try {File sd Environment.getExternalStorageDirectory();File data Environment.getDataDirectory();if (sd.canWrite()) {String currentDBPath //data// PackageName //databases// DatabaseName;String backupDBPath /BackupFolder/DatabaseName;File backupDB new File(data, currentDBPath);File currentDB new File(sd, backupDBPath);FileChannel src new FileInputStream(currentDB).getChannel();FileChannel dst new FileOutputStream(backupDB).getChannel();dst.transferFrom(src, 0, src.size());src.close();dst.close();Toast.makeText(getBaseContext(), backupDB.toString(),Toast.LENGTH_LONG).show();}} catch (Exception e) {Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG).show();}}