title: How to check if file is already created before writing a new file?
body: <p>I am using android studio just to see how to create a file, or if a file already exists use the existing file. My code so far is:</p>
  
  <pre><code>              public void saveFile(){
  
              try{
  
              FileOutputStream fOut = openFileOutput("current.xml", 
              Context.MODE_APPEND);
              //OutputStreamWriter outputWriter = new 
               OutputStreamWriter(fOut);
  
              XmlSerializer serializer = Xml.newSerializer();
              serializer.setOutput(fOut, "UTF-8");
              serializer.startDocument(null, Boolean.valueOf(true));
  
              serializer.startTag(null, "records");
              serializer.startTag(null,"employee");
              serializer.startTag(null, "name");
              serializer.text("Ryan");
              serializer.endTag(null,"name");
              serializer.startTag(null,"surname");
              serializer.text("Derk");
              serializer.endTag(null,"surname");
              serializer.startTag(null,"salary");
              serializer.text("60000");
              serializer.endTag(null,"salary");
              serializer.endTag(null,"employee");
              serializer.endTag(null,"records");
  
              serializer.endDocument();
              serializer.flush();
              fOut.close();
  
              Toast.makeText(getApplicationContext(), "Save Successful", 
              Toast.LENGTH_LONG).show();
  
              }
              catch(Throwable t){
  
              Toast.makeText(getApplicationContext(), "Save Unsuccessful", 
              Toast.LENGTH_LONG).show();
  
          }
  
  
          }
  
           private static String getValue(String tag, Element element) {
           NodeList nodeList = 
           element.getElementsByTagName(tag).item(0).getChildNodes();
           Node node = nodeList.item(0);
           return node.getNodeValue();
          }
  </code></pre>
  
  <p>How can i check if the file is already created before saving to that file? And if it is not created create the file?</p>