Skip to content

Instantly share code, notes, and snippets.

private void copyBigDataToSD(String strOutFileName) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
//申请WRITE_EXTERNAL_STORAGE权限
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.READ_EXTERNAL_STORAGE},
1);
}
InputStream myInput = null;
OutputStream myOutput = null;
File myDir = new File(strOutFileName);