如何在Android中卸载我的应用程序中删除SD卡的文件夹? [英] How to delete folders from SDCard during uninstalling of my app in android?

查看:190
本文介绍了如何在Android中卸载我的应用程序中删除SD卡的文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过以下链接它说去该外部文件夹会自动我的应用程序的卸载过程中被删除。

I went through the following link which says that the external folders will be deleted automatically during uninstallation of my app.

我使用下面的code创建的文件夹和文件

I am using the following code to create the folders and file

private static String TEMP_FOLDER_PATH = Environment.getExternalStorageDirectory() + "/myAppFolder/";

我的问题是,当我卸载应用程序的文件夹myAppFolder没有被清除。

My problem is that the folder myAppFolder is not getting deleted when I uninstall the app.

请帮忙,让我知道如果我去任何地方错了...

Please help and let me know if I am going anywhere wrong...

推荐答案

将它保存在你的应用程序私人文件夹(/数据/数据​​/ yourappPackege 的)。卸载应用程序时,这个文件夹将被删除。
你可以得到你的私人文件夹的方法 getFilesDir() 其他文件无法删除,因为您的应用程序并不知道它被删除时。

Save it in your Apps Private Folder (/data/data/yourappPackege). This folder will be removed when uninstalling the App.
You can get your private Folder with the Method getFilesDir() Other files can not be removed because your App does not "know" when it is being removed.

这篇关于如何在Android中卸载我的应用程序中删除SD卡的文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆