当我检查一个Android应用程序时...我发现应用程序中的视频是上传到SD卡中...例如:mnt / sdcard ...有没有办法找到这个SD卡的网址.. ..因为......我需要报告这个非法的内容..有什么办法请帮助....我经历过但我没有得到正确的答案...请帮助.. how can i mount sdcard programmatic?
答案 0 :(得分:1)
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://" + Environment.getExternalStorageDirectory())));
查找文件的位置很简单:
我的sdcard /我的文件夹名称/视频中有视频,然后路径是
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;
}
答案 1 :(得分:0)
试试这个..
Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) {
File f = Environment.getExternalStorageDirectory();
这将为您提供外部存储路径。您也可以使用:“/ mnt / sdcard” 如果仍然不清楚,请查看此链接:Link
希望这会对你有所帮助。