Picking up an audio file android

后端 未结 5 1151
花落未央
花落未央 2021-01-31 19:11

I need to fetch an audio file from SD Card and play it. I think this can be done by getting URI of an audio file. So, to pick an audio file I\'m using following code:

         


        
5条回答
  •  情书的邮戳
    2021-01-31 19:28

    final Uri uri=Uri.parse(Environment.getExternalStorageDirectory()+"/Audio/abc.mp3");
    

    Replace /Audio/abc.mp3 with your path of mp3 file on sdcard.

    Dont forget to check if the external storage is mounted. Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)

提交回复
热议问题