如何获取使用 Context.MODE_PRIVATE 存储的图像的图像路径

How to get image path of an image stored using Context.MODE_PRIVATE

您好,我使用以下代码成功存储和获取图像 存储图像

FileOutputStream fos = getActivity().openFileOutput(picName, Context.MODE_PRIVATE);
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                compressed_bitmap.compress(Bitmap.CompressFormat.JPEG, 95, bos);
                byte[] img = bos.toByteArray();
                fos.write(img);
                fos.close();

获取图片

InputStream input = getActivity().openFileInput(imageName);
                        Bitmap bitmap = BitmapFactory.decodeStream(input,null,null);

但我还需要知道 path.How 以获取图像所在的路径 stored.Any 将不胜感激并提前致谢。

你可以在你的片段中试试这个方法

String absolutePath = getActivity().getFileStreamPath(imageName);