如何删除编程方式在Android 2.2的SD卡的全部内容全部内容、方式、Android、SD

2023-09-13 01:16:34 作者:惹我 你小心点゜

我想删除的用户全SD卡编程中的Andr​​oid 2.2。

什么是做到这一点的最简单的方法是什么?

它会需要root权限?

我可以做一个室射频到/ mnt / SD卡或做我必须做一个递归循环?

解决方案

您可以删除目录与Java。你要做的是递归的,如果他们不为空: HTTP://www.exampledepot .COM / EGS / java.io / DeleteDir.html

在Eclipse Android中设置模拟器屏幕大小

没有。所有的应用程序都完全RW访问外部存储器。

是的,你可以执行shell命令(但你必须检查是否RM可用):Any的方式来运行在Android编程?

shell命令

检查可用的命令:How我可以得到有关Android的壳可用命令外壳信息?

I wish to delete the users entire SDcard programmatically in Android 2.2.

What is the easiest way to do this?

Will it require root rights?

Can I just do an "rm -rf /mnt/sdcard" or do I have to make a recursive loop?

解决方案

You can delete directories with Java. You have to do it recursively if they are not empty: http://www.exampledepot.com/egs/java.io/DeleteDir.html

No. All applications have full RW access to external storage.

Yes you can execute shell commands (but you'll have to check if "rm" is available): Any way to run shell commands on android programmatically?

Checking for available commands: How can I get information from the shell about commands available in Android shell?