我想複製從應用程序的路徑PDF文件(/數據/數據/包的名稱),以sdcard.for,我已經準備好以下,如何將文件從應用程序包路徑複製到SD卡?
try {
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(destFile).getChannel();
destination.transferFrom(source, 0, source.size());
}
finally {
if(source != null) {
source.close();
}
if(destination != null) {
destination.close();
}
}
它不能正常工作,請您及時的幫助。
這樣的支持方式是把你的包中的資產文件夾興趣文件,並使用和使用assetManager.open()來獲取輸入流如http://stackoverflow.com/questions/4447477/android-how-to-copy-files-in-assets-to-sdcard。黑客解決方案是要知道apk是zip文件的一種形式,並用zip文件類打開它。 –