Reputation: 145
When I run the app on Nexus 5 there are no problem with the file but in another smartphone I have a problem, I think it could be the spaces and I deleted it.
The code is :
File file = new File(directory,new SimpleDateFormat("dd-MM-yyyy-HH:mm:ss",Locale.ROOT).format(new Date()).toString()+"-"+idUser+"-"+idTest+".txt");
FileOutputStream outputStream = new FileOutputStream(file);
path file: /storage/sdcard0/Nexio/Tests/23-07-2014-16:33:11-alex-0.txt
The directory exists. And the exception is "FileNotFoundException"
Upvotes: 1
Views: 878
Reputation: 4958
you are probably setting directory with a static string.. that would be my guess.. use http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory()
Upvotes: 1