title: Issue accessing local xml files in apk file - Air for Android
body: <p>This is my first time really getting my teeth into Air for Android so please forgive me if this issue has been covered already. If it has then I've been unable to find it.</p>
  
  <p>So I have an application that loads and displays xml data. 
  In the app I've got code to check if wiFi or equivalent is available and if so then pull live xml file and if not then pull the local xml file that was packaged with the application.
  The app works fine if I am pulling in the xml from the live url but not if pulling from local.</p>
  
  <p>After doing some research I discovered that when pulling in local file then Air for Android works slightly differently. So I need to resolve the application directory. 
  I did this and still no joy.</p>
  
  <p>After a bit more research I read some post's that said I should use fileStream()
  Tried this and still nada :(</p>
  
  <p>All the time whilst testing in Flash IDE it works as intended.</p>
  
  <p>If I had any more hair left I would be pulling it out right now!
  The local xml file is set in the "includes"</p>
  
  <p>Sample code below I am using for testing</p>
  
  <pre><code>var subURL:String = "xml_feeds/myxmlfile.xml"
  var fileStream:FileStream = new FileStream();
  var file:File = File.applicationDirectory.resolvePath(subURL);
  fileStream.addEventListener(Event.COMPLETE, processXMLData);
  fileStream.openAsync(file, FileMode.READ);
  MovieClip(parent).txStates.text = file.url+" - TRYING"
  var prefsXML:XML = new XML()
  function processXMLData(event:Event):void{
      MovieClip(parent).txStates.text = file.url+" - OPEN"
      prefsXML = XML(fileStream.readUTFBytes(fileStream.bytesAvailable));
      var tempArr:Array = new Array();
      var reportCount:Number = prefsXML.row.column.length()
      for (var i = 0; i &lt; reportCount; i++) {
          var rName:String = prefsXML.row.column[i].@name.toString();
          var rValue:String = prefsXML.row.column[i].toString();
          var rTitle:String = prefsXML.row.column[i].@name.toString()
          tempArr.push([rName, rValue, rTitle]);
      }
      showData()
      fileStream.close();
  }
  </code></pre>
  
  <p>Is there anything I've missed?</p>
  
  <p><strong>UPDATE: 21/08/12</strong>
  No idea what is going on with this. Here is the code i now have to use in order to load in the local xml file. Seems rather long winded</p>
  
  <pre><code>function listing():void{
  var folders:Array = new Array();
  folders = File.applicationDirectory.getDirectoryListing();
  for(var i:Number =0;i&lt;folders.length;i++){
      if(folders[i].isDirectory){ 
          if(folders[i].name=="xml_feeds"){
              var files:Array = new Array();
              files = folders[i].getDirectoryListing();
              for(var j:Number=0;j&lt;files.length;j++){
                  if(files[j].name=="CTSection2.xml"){
                      fileStream.openAsync(files[j], FileMode.READ);
                      fileStream.addEventListener(Event.COMPLETE, processXMLData);
                      fileStream.addEventListener(IOErrorEvent.IO_ERROR, localXMLFailLoad);
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>}</p>