File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
File logfile = new File(path, "andrometer.txt");
String[] assignArr = new String [7];
assignArr[0]= finalValue + "17";
assignArr[1]= range + "16";
assignArr[2]= activeMode;
if (assignArr.length > 0)
{
try {
if (path.canWrite()){
FileWriter filewriter = new FileWriter(logfile);
BufferedWriter out = new BufferedWriter(filewriter);
for (int i1=0; i1<assignArr.length; i1++)
{
out.write(assignArr[0] + "\n");
out.write(assignArr[1] + "\n");
out.write(assignArr[2] + "\n");
Toast.makeText(AndroMeter.this, "out: " + assignArr[2], Toast.LENGTH_LONG).show();
}
out.close();
}
} catch (IOException e) {
Log.e("TAG", "Could not write file " + e.getMessage());
}
};
This code was working a couple weeks ago and now I can't seem to get it to. I have the permission in the manifest correctly I believe, I tried writing to root instead of specific folder, I've been testing with dummy data in place of the variable names. No file is being created at this point.