当我检查Android应用程序时...我发现应用程序中的视频上传到SD卡中..例如:mnt/sdcard...有没有办法找到该SD卡的URL.. ..因为...我的需要是报告此非法内容..有什么办法请帮助...我经历过,但没有得到正确的答案...请帮助.. how can i mount sdcard programmatic?
最佳答案
以编程方式挂载 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;
}
关于java - 如何找到SD卡的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15968865/