Saving file to arraylist and writing back to file; Android
===

I've been trying to open a text file and and save each line as the contents of an arraylist. Once this has been completed I would like to save it back to a file. I have been running into errors for so long and have tried numerous techniques. I found that for some reason, the files themselves are not being created. It may just be a simple error I'm overlooking but if you could provide any help I will be thankful. 

Here's the code:

    public void addToFile(){

    File root = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/appName/savedlocations");
    root.mkdirs();
    File fileName = new File(root, "locationslatitude.txt");
    File fileName2 = new File(root, "locationslongitude.txt");
    
    String file = fileName.toString();
    String file2 = fileName2.toString();

    String theContent = Double.toString(currLatitude);
    String theContent2 = Double.toString(currLongitude);

    s = new Scanner(file);
	    while (s.hasNext()){
	        fileList.add(s.next());
	    }
	    s.close();
	    fileList.add(theContent);
    
    	
    
	    s2 = new Scanner(file2);
	    while (s2.hasNext()){
	        fileList2.add(s2.next());
	    }
	    s2.close();
	    fileList2.add(theContent2);


    try {//works for latitude file
    	    FileWriter writer = new FileWriter(file); 
    	    for(String str: fileList) { 
    	      writer.write(str);
    	      writer.write("\r\n");
    	    }
    	    writer.close();
		    } catch (java.io.IOException error) {
		      //do something if an IOException occurs.
			    Toast.makeText(this, "Cannot Save Back To A File", Toast.LENGTH_LONG).show();
		}
    //save the arraylist back to its appropriate file
        try {//works for longitude file
    	    FileWriter writer = new FileWriter(file2); 
    	    for(String str2: fileList2) { 
    	      writer.write(str2);
    	      writer.write("\r\n");
    	    }
    	    writer.close();
		} catch (java.io.IOException error) {
		  //do something if an IOException occurs.
			Toast.makeText(this, "Cannot Save Back To A File", Toast.LENGTH_LONG).show();
		}
    }