Bitmap bitmap = BitmapFactory.decodeResource(getActivity().getResources(),R.drawable.erweima);
String path = FileUtils.instance().getImageCachePath()+"YjttQrCode.jpg";
File file = new File(path);
try {
if (!file.exists()) {
file.createNewFile();
}
FileOutputStream fos = new FileOutputStream(path);
bitmap.compress(Bitmap.CompressFormat.JPEG,100,fos);
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Toast.makeText(getActivity(),"保存成功!",Toast.LENGTH_SHORT).show();
Intent intent1 = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Uri uri = Uri.fromFile(file);
intent1.setData(uri);
getActivity().sendBroadcast(intent1);
大神帮看看我将图片保存在本地,为什么在相册中看不见?在文件夹里都能看到