title: Editing XML file in a Java program (Android Studio) with info from a dynamically created array
body: <p>I am making an android app (java) where I need to edit an XML file with different routes. I am trying to figure out what would be the best way to edit an XML file with values of a dynamically created array?</p>
  
  <p>So I have a String array named ROUTES[], that gets an updated list of routes from my database.</p>
  
  <p>I need to add that data into a XML file in the following format:</p>
  
  <pre><code>&lt;resources&gt;
  &lt;string name="app_name"&gt;Route Maps&lt;/string&gt;
  &lt;string name="title_activity_maps"&gt;Map&lt;/string&gt;
  &lt;string name="pickUpButtonText"&gt;Need a lift&lt;/string&gt;
  &lt;string name="choose_route"&gt;Route 1&lt;/string&gt;
  &lt;string-array name="routes"&gt;
      &lt;item&gt;Route 2&lt;/item&gt;
      &lt;item&gt;Route 3&lt;/item&gt;
      &lt;item&gt;Route 4&lt;/item&gt;
  &lt;/string-array&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>The XML above is used to generate a spinner in android so user can select which route they want to see. Routes can be edited and added, hence why I need to dynamically add the values from ROUTES[] array. </p>
  
  <p>Any suggestions the best and easiest way to do this?</p>
  
  <p>Also how would I reference this XML file (that is in the project) in Java? Would I give relative path or absolute path?</p>