private void copyBigDataToSD(String strOutFileName) throws IOException { InputStream myInput; OutputStream myOutput = new FileOutputStream(strOutFileName); myInput = this.getAssets().open("videoChar.apk"); byte[] buffer = new byte[1024]; int length = myInput.read(buffer); while(length > 0) { myOutput.write(buffer, 0, length); length = myInput.read(buffer); } myOutput.flush(); myInput.close(); myOutput.close(); System.out.println("拷貝成功"); }
這段代碼就是把assets目錄下的文件拷貝到SDK java
填入的參數就是你輸出的路徑 ide
相似Environment.getExternalStorageDirectory()+"/videoChar.apk" this