将bitmap保存到sd卡
来源:互联网 发布:单片机汇编set 编辑:程序博客网 时间:2024/06/05 15:55
/**
* Store image to SD card.
*/
private String storeImageToFile(Bitmap bitmap){
if(bitmap == null){
return null;
}
int count = 15; //the number which will prevent the create segment locked.
File file = null;
RandomAccessFile accessFile = null;
int MagicNum;
String path = null;
do{
MagicNum = (int)mRandom.nextLong();
path = path + "/" + String.valueOf(MagicNum) + ".png";
file = new File(path);
count--;
}while(!file.exists() && count > 0);
ByteArrayOutputStream steam = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, steam);
byte[] buffer = steam.toByteArray();
try {
accessFile = new RandomAccessFile(file, "rw");
accessFile.write(buffer);
} catch (Exception e) {
return null;
}
try {
steam.close();
accessFile.close();
} catch (IOException e) {
//Note: do nothing.
}
return path;
}
* Store image to SD card.
*/
private String storeImageToFile(Bitmap bitmap){
if(bitmap == null){
return null;
}
int count = 15; //the number which will prevent the create segment locked.
File file = null;
RandomAccessFile accessFile = null;
int MagicNum;
String path = null;
do{
MagicNum = (int)mRandom.nextLong();
path = path + "/" + String.valueOf(MagicNum) + ".png";
file = new File(path);
count--;
}while(!file.exists() && count > 0);
ByteArrayOutputStream steam = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, steam);
byte[] buffer = steam.toByteArray();
try {
accessFile = new RandomAccessFile(file, "rw");
accessFile.write(buffer);
} catch (Exception e) {
return null;
}
try {
steam.close();
accessFile.close();
} catch (IOException e) {
//Note: do nothing.
}
return path;
}
- 将bitmap保存到sd卡
- 将Bitmap保存到SD卡
- 保存Bitmap到SD卡
- Bitmap保存到SD
- 把view保存成bitmap,保存bitmap到sd卡
- android 保存bitmap到SD卡
- android 保存bitmap到SD卡
- android保存Bitmap图片到sd卡
- android 保存bitmap到SD卡
- android 保存bitmap到SD卡
- 将Bitmap写入到sd卡
- android开发将Bitmap转换成图片保存到sd卡
- Android开发将Bitmap转换成图片保存到sd卡
- Android将Bitmap 以图片形式保存到sd卡中
- Android—将Bitmap图片保存到SD卡目录下或者指定目录
- Android—将Bitmap图片保存到SD卡目录下或者指定目录
- Android中将Bitmap以数组形式保存到SD卡
- android 保存bitmap图片到sd卡中文件夹
- 【Android病毒分析报告】 - Obad
- HEVC参考图像列表(二)之广义B帧技术GPB
- 如何查找SAP的旧TCODE对应新的TCODE
- Cocos2d-x2.1.1-ClippingNodeTest深入分析(二)
- 经典算法排序——插入排序
- 将bitmap保存到sd卡
- [MySQL]精妙SQL语句,基础,提升,技巧
- linux设备驱动归纳总结(九):1.platform总线的设备和驱动
- TCP长连接与短连接的区别
- iPhone真机调试安装流程
- 杭电 acm 1716 java 实现 格式很变态
- 25个增强iOS应用程序性能的提示和技巧(初级篇)
- 第十四周 项目一(3)
- std::vector中的find