我的应用程序使用 SDCard 来存储数据(大约 100 Mb 的内容)。我想在通过应用程序管理器删除应用程序时删除这些文件,并提供一种清除其中数据的方法(就像 Google Apps 那样)。有任何想法吗 ?
最佳答案
引用自http://developer.android.com/guide/topics/data/data-storage.html
Accessing files on external storage
If you're using API Level 8 or greater, use getExternalFilesDir() to open a File that represents the external storage directory where you should save your files. ... If the user uninstalls your application, this directory and all its contents will be deleted.
据我了解,这将在 SD 卡上创建一个文件,该文件具有范围(如应用程序包命名空间的目录),并且当您卸载应用程序时,手机将删除该目录。我想这就是 Google 应用程序实现此功能的方式。
关于java - Android - 从 SDCard 中删除数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2718269/