public void copyFile(String copyPath,String pastePath){
String abPath=Environment.getExternalStorageDirectory().getPath();
File copyFile=new File(copyPath);
File pasteFile=new File(pastePath);
String fileName=new File(pastePath).getName();
FileInputStream inputStream=null;
try{
inputStream=new FileInputStream(copyFile);
}catch(FileNotFoundException e){
e.printStackTrace();
}
FileOutputStream outputStream=null;
try{
outputStream=new FileOutputStream(pasteFile);
}catch(FileNotFoundException e){
e.printStackTrace();
}
FileChannel fcin=inputStream.getChannel();
FileChannel fcout=outputStream.getChannel();
long size = 0;
try {
size = fcin.size();
} catch (IOException e) {
e.printStackTrace();
}
try {
fcin.transferTo(0, size, fcout);
} catch (IOException e) {
e.printStackTrace();
}
try {
fcout.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
fcin.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
위에 코드대로 제가 copyPath를 입력하면 pastePath에 복사가 되도록 짜봤는데요
제 폰으로 실험한결과 내부에서 내부로, 외장sd에서 내부로 usb에서 내부로는 복사가됩니다
근데 왜 내부에서 외장sd나 usb로 복사가안될까요...?ㅠㅠ
도와주십쇼!!!고수님들