drqvr26084 2013-04-12 10:21 采纳率: 100%
浏览 40
已采纳

如何找到SD卡的位置

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

  • 写回答

2条回答 默认 最新

  • douhui5529 2013-04-12 10:25
    关注

    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;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?