Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load File on Android

I want load a file wav from sdcard in my android project but I don't succeed. I'm using

File sdcard = Environment.getExternalStorageDirectory();
File file = new File(sdcard,"/mnt/sdcard/.....wav");

but I get this error

java.io.FileNotFoundException: /mnt/sdcard/mnt/sdcard/......wav (No such file or directory)

Can you help me, please?

like image 517
user3582433 Avatar asked Feb 27 '26 17:02

user3582433


1 Answers

the first parameter is already the path - do not put /mnt/sdcard/ to the second parameter

File sdcard = Environment.getExternalStorageDirectory();
File file = new File(sdcard,".....wav");
like image 63
ligi Avatar answered Mar 01 '26 06:03

ligi