Get External SDCard Location in Android

后端 未结 4 1768
别那么骄傲
别那么骄傲 2020-12-29 10:50

I have an app with huge data pre-stored in the SD Card.

We are supporting all tablets ICS onwards. I am not able to find a way to access the SDCard

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-29 11:30

    Its simple.

    String f = Environment.getExternalStorageDirectory().getAbsolutePath();
    Log.v("TAG",f);//to print the path of sdcard
    

    if you want to access a file then.

    String f =  Environment.getExternalStorageDirectory()+"/file.ext";
    Log.v("TAG",f);//to print the path of file in Logcat.
    

提交回复
热议问题