This is a continuation from this post but basically I can't access the files that are inside of a folder on my device storage but I can access files that are outside of any folder.
For example displayCurrentBodyTempArray function works when temp.txt is referenced but not when boyTempTest.txt is referenced that is inside the download folder. And as I don't know how to NOT download something, over bluetooth(which I have to do), and have it go to that folder I am confused. I just can't access that folder. Any help is appreciated!
bodyTempInfo function
ArrayList<Double> currentBodyTemp;
public void displayCurrentBodyTempArray(View view) throws FileNotFoundException {
ArrayList<Double> list = new ArrayList<>();
File sdcard = Environment.getExternalStorageDirectory();
//Get the text file
//Read text from file
File file = new File(sdcard, "bodyTempTest-1.txt");
StringBuilder text = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
text.append(line);
list.add(Double.parseDouble(line));
text.append('\n');
}
br.close();
}
catch(IOException e) {
}
currentBodyTemp = list;
displayBodyTemp("Your Body Temperature Readings are:" + text);
}
displayBodyTemp function
private void displayBodyTemp(String bodyTemp) {
TextView textView = (TextView) findViewById(R.id.bodyTempInfoArray);
textView.setText(bodyTemp);
}
Device Storage screenshot of temp.txt, which is accessible with that code, and bodyTempTest.txt inside of download folder which isn't accessible with that code.