- public static void copyFileFromAssetsToSDCard() throws Throwable {
- InputStream inStream = this.getAssets().open("hello.zip");
- String filePath = android.os.Environment.getExternalStorageDirectory()
- .getAbsolutePath() + "/" + "hello.zip";
- OutputStream outStream = new FileOutputStream(filePath);
- byte[] buffer = new byte[1024];
- int length = inStream.read(buffer);
- outStream.write(buffer, 0, length);
- outStream.flush();
- inStream.close();
- outStream.close();
- }
转载于:https://my.oschina.net/handsomeban/blog/148542