简体   繁体   English

如何将图像从 ImageView 保存到 Android 共享存储? 当用户卸载应用程序时,我不希望我的图像被删除

[英]How to save Image from ImageView to Android Shared Storage? I dont want my images to delete when user uninstall the app

I want to store my file in android Shared Storage.我想将我的文件存储在 android 共享存储中。 All the ways I have found store image in internal storage which I don't want because internal storage will be deleted when user uninstall the app.我在内部存储中找到存储图像的所有方法都是我不想要的,因为当用户卸载应用程序时内部存储将被删除。 A code would be helpful which store the image from ImageView to shared storage.将图像从 ImageView 存储到共享存储的代码会很有帮助。 I have tried reading android documentation but I don't understand what's written there.我试过阅读 android 文档,但我不明白那里写了什么。

Looking at the table below you should use the MediaStore API for the job.查看下表,您应该使用 MediaStore API 来完成这项工作。 Source: Android data storage overview来源: Android 数据存储概述

在此处输入图像描述

Then here's a thorough example how you can write image to file using the MediaStore API.然后这是一个完整的示例,您如何使用 MediaStore API 将图像写入文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当用户在android中选择卸载我的应用程序时如何删除文件夹 - How to delete a folder when user selects uninstall my application in android Android:在卸载时从外部存储中删除应用相关文件? - Android: Delete app associated files from external storage on Uninstall? 如何将imageView图像保存到图库(Android开发) - How do I save my imageView image into Gallery (Android Development) 我想开发我的 android 代码以在保存到外部存储之前减少从相机捕获的图像文件大小 - I want to develop my android code to reduce the image file size capture from camera before save to external storage 如何将图像保存在存储特定文件夹(图库)中并使用 java 从 android 11 以上或以下的存储中获取图像? - How do I save images in storage particular folder (gallery) & Get image from storage in above android 11 or below with java? 从应用程序上的图库中删除图像文件夹,以编程方式卸载Android - Delete Image Folder from Gallery on App Uninstall Android Programatically 如何使用共享首选项将图像保存到ImageView - How to Save images to ImageView using Shared Preferences 在 ImageView 中显示图像并将其保存到 Android 的内部存储中 - Display Image in ImageView and save it to internal storage on Android 我要允许用户从用户设备在imageView中添加图像吗? - I want to allow user to add image in imageView from user device? 如何在Android应用程序的SharedPreferences中保存图像路径? 我的代码不起作用 - How to save an image path in SharedPreferences in Android app? my code dont work
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM