android从assets目录复制到sd卡

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();
}

你可能感兴趣的:(Android文件操作)