void copyFileFromAssetsToSDCard() throws Throwable {
//将目标文件变成输入流
InputStream inStream = this.getAssets().open("qq.png");
//判断外部存储卡是否存在
if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
Toast.makeText(getApplicationContext(), "读取失败,SD存储卡
在!",Toast.LENGTH_LONG).show();
return;
}
//目标文件要放到sd卡中的位置
String filePath = Environment.getExternalStorageDirectory()
.getAbsolutePath() + "/"+"ssf/" + "qq.png";
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();
}