简体   繁体   中英

How to find the location of sdcard

when i was checking an android app...I found that the videos in the app is uploaded in an sdcard..for ex:mnt/sdcard...is there an way to find the url of this sdcard....because...my need is to report this illegal content..is there any way please help....I gone through but i didn't get a proper answer...please help.. how can i mount sdcard programmatic?

Programmatic sdcard mounting/unmounting

Mount SDCARD Programatically..

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

find Location of file is simple:

i have video in my sdcard/my folder name/video then path is

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

check external stroge available or not??

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;
}

Try this..

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

This will give you External storage path.You can also use this:"/mnt/sdcard" If still not clear then take a look at this link: Link

Hope this will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM