user2223317
user2223317

Reputation: 211

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

Upvotes: 0

Views: 110

Answers (2)

Dhaval Parmar
Dhaval Parmar

Reputation: 18978

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

Upvotes: 1

AndiM
AndiM

Reputation: 2188

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.

Upvotes: 0

Related Questions