0

当我检查一个 android 应用程序时...我发现应用程序中的视频上传到 sdcard 中..例如:mnt/sdcard...有没有办法找到这个 sdcard 的 url...因为...我的需要是报告此非法内容..有什么办法请帮助....我经历了但我没有得到正确的答案...请帮助.. 我如何以编程方式安装 sdcard?

程序化 sdcard 挂载/卸载

4

2 回答 2

1

以编程方式挂载 SDCARD..

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
 Uri.parse("file://" +  Environment.getExternalStorageDirectory())));

查找文件的位置很简单:

我的 SD 卡/我的文件夹名称/视频中有视频,然后路径是

File videoPath = new File(Environment.getExternalStorageDirectory()+"/myFolderName/video1.mp4");

检查外部存储是否可用?

boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();

if (Environment.MEDIA_MOUNTED.equals(state)) {
    // We can read and write the media
    mExternalStorageAvailable = mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
    // We can only read the media
    mExternalStorageAvailable = true;
    mExternalStorageWriteable = false;
} else {
    // Something else is wrong. It may be one of many other states, but all we need
    //  to know is we can neither read nor write
    mExternalStorageAvailable = mExternalStorageWriteable = false;
}
于 2013-04-12T10:25:07.513 回答
0

试试这个..

Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) {
File f = Environment.getExternalStorageDirectory();

这将为您提供外部存储路径。您也可以使用此:“/mnt/sdcard” 如果仍然不清楚,请查看此链接:链接

希望这会帮助你。

于 2013-04-12T10:29:53.920 回答