下载的图片不会出现在图库中

时间:2016-05-20 08:13:29

标签: java android

我应该如何解决

File root = new File(Environment.getExternalStorageDirectory() + File.separator + getResources().getString(R.string.app_name) + File.separator);
        root.mkdirs();
        File sdImageMainDirectory = new File(root, fileName);
        output = new FileOutputStream(sdImageMainDirectory);
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, output);
        output.flush();
        result = true;
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (null != output) {
            try {
                output.close();
            } catch (IOException e) {
                e.printStackTrace();

            }
        }
    }
    return result;
}strong text

0 个答案:

没有答案