保存图片到本地并可以在相册中显示出来
来源:互联网 发布:二手船用雷达淘宝网 编辑:程序博客网 时间:2024/06/10 14:19
public class SavePictureUtils { /** * 首先默认个文件保存路径 */ private static final String SAVE_PIC_PATH = Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED) ? Environment.getExternalStorageDirectory().getAbsolutePath() : "/mnt/sdcard";//保存到SD卡 private static final String SAVE_REAL_PATH = SAVE_PIC_PATH + "/qujiayou/savePic";//保存的确切位置 public static void saveFile(Bitmap bm, String fileName, String path) throws IOException { String subForder = SAVE_REAL_PATH + path; File foder = new File(subForder); if (!foder.exists()) { foder.mkdirs(); } File myCaptureFile = new File(subForder, fileName); if (!myCaptureFile.exists()) { myCaptureFile.createNewFile(); } BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile)); bm.compress(Bitmap.CompressFormat.JPEG, 80, bos); bos.flush(); bos.close(); Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri uri = Uri.fromFile(myCaptureFile); intent.setData(uri); context.sendBroadcast(intent);//这个广播的目的就是更新图库,发了这个广播进入相册就可以找到你保存的图片了!,记得要传你更新的file哦 }}
0 0
- android保存图片到本地并可以在相册中显示出来
- android保存图片到本地并可以在相册中显示出来
- android保存图片到本地并可以在相册中显示出来
- android保存图片到本地并可以在相册中显示出来
- android保存图片到本地并可以在相册中显示出来
- 基于Android实现保存图片到本地并可以在相册中显示出来
- 保存图片到本地并可以在相册中显示出来
- android保存图片到本地并可以在相册中显示出来
- 使用okhttp异步下载图片,保存到本地,并在系统相册中显示
- Android实现保存图片到本地并在相册中显示
- 图片保存到本地在相册中无法显示问题
- 保存图片到本地,并及时在系统相册更新
- Android 使用系统相机拍摄照片保存到本地并在系统相册中显示
- iOS拍照 相册选取 保存PNG图片到Documents下,并利用UICollectionView显示出来
- Android网络获取图片保存到本地,并在ViewPager中显示图片
- 将图片保存在本地相册中
- 安卓开发关于图片保存到本地相册并显示功能
- 图片保存到本地相册
- python 字符串的split()函数详解
- CUDA 8.0 + cudnn5.1 + OpenCV3.1.0(Ubuntu14.04)
- easyUI使用技巧收集
- Qt库制作及测试
- 20170511_请说清楚什么是菱形继承
- 保存图片到本地并可以在相册中显示出来
- QT 启动新线程执行QTimer
- three.js3D学习(2)
- NumPy doc (三)
- Could not find method compile() for arguments
- Recurrent Neural Networks
- Android获得手机唯一设备ID号
- is marked as crashed and should be repaired when using LOCK TABLES
- Linux 4.1最新内核usb与hid驱动分析记录