I have some java code:
public void writeToFile(String data, Context ctx) {
String path = Environment.getExternalStorageDirectory().getAbsolutePath();
File tempFile = new File(path, "houseDataFile.txt");
try
{
FileOutputStream fOut = new FileOutputStream(tempFile);
fOut.write(data.getBytes());
fOut.close();
Toast.makeText(ctx, "Saved", Toast.LENGTH_SHORT).show();
}catch (Exception e)
{
Log.w(TAG, "FileOutputStream exception: - " + e.toString());
}
}
When I call this function it makes the Toast and says "Saved", but then when I go to my external storage on the device, the file is non existent, and my app directory is not there. Can anyone give me some pointers as to why nothing is actually being created?