I'm looking to reaccess a file created in android studio. I found the following code snippet on stack exchange
File root = android.os.Environment.getExternalStorageDirectory();
// See http://stackoverflow.com/questions/3551821/android-write-to-sd-card-folder
File dir = new File(root.getAbsolutePath() + "/download");
File file = new File(dir, "myData.txt");
From my understanding this creates a file called "myData.txt" in the download folder. What im looking to do is pass "file" into a function in another method like so
public void onLocationChanged(Location location) {
ArrayList<Location> list = new ArrayList<>();
list.add(location);
GPX.writePath(file,"hello",list);
}
How do I go about creating a file variable that acesses the txt file without actually creating a new file?