I have a method that writes to a log file. If the file exists it should append to it, if not then I want it to create a new file.
if (!file.exists() &&am
You are certainly getting this Exception 'The system cannot find the path specified'
Just print 'file.getAbsoluteFile()' , this will let you know what is the file you wanted to create.
This exception will occur if the Directory where you are creating the file doesn't exist.
In my case was just a lack of permission:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
try to ensure the parent directory exists with:
file.getParentFile().mkdirs()