private void exportDB(){
File sd = Environment.getExternalStorageDirectory();
      File data = Environment.getDataDirectory();
       FileChannel source=null;
       FileChannel destination=null;
       String currentDBPath = "/data/"+ "com.authorwjf.sqliteexport" +"/databases/"+DB_NAME;
       String backupDBPath = DB_NAME;
       File currentDB = new File(data, currentDBPath);
       File backupDB = new File(sd, backupDBPath);
       try {
            source = new FileInputStream(currentDB).getChannel();
            destination = new FileOutputStream(backupDB).getChannel();
            destination.transferFrom(source, 0, source.size());
            source.close();
            destination.close();
            Toast.makeText(this, "DB Exported!", Toast.LENGTH_LONG).show();
        } catch(IOException e) {
        e.printStackTrace();
        }
}

'Andorid' 카테고리의 다른 글

Export SQLite DB  (0) 2019.02.22
Android Emulators  (0) 2018.03.02
Android 에서 각종 아이콘이 표시 결과 확인하기  (0) 2017.12.30
Google Play 게임 만들때 읽어야할 글  (0) 2017.12.24
google-play-services(libproject)  (0) 2017.12.08
FCM 과 GCM 차이? - 펌  (0) 2017.11.25

+ Recent posts