title: better way to communicate between python script and android application
body: <p>In my android project I am reading a xml file which are continuously updated by one python script. and for update data I am continuosly reading the xml file and whenever the data is updated in xml file by python script I used that in my app.</p>
  
  <p>But now problem is, because of python script and my android project continuosly accessing one xml file (One resource so I think concurrency problem), it takes so much time to get data from xml file and write data to xml file through python script.</p>
  
  <p>So, Is there any simply way to communicate between python script and android app so I will avoid the use of xml file and directly used the data send to me by python script? 
  And also it gives me faster execution.</p>
  
  <p>I tried this, (This is my android code for accessing xml file)</p>
  
  <pre><code>public void getData() throws Exception {
  try
  {
      while(!isStop)
      {
          isStop=parseXmlData();          
  
      }   
   }
  catch(Exception e)
  {
      e.printStackTrace();
  }
    }
  
  
  
  private boolean parseXmlFile(){
      //get the factory
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      boolean flag=false;
      try {
  
          //Using factory get an instance of document builder
          DocumentBuilder db = dbf.newDocumentBuilder();
          //parse using builder to get DOM representation of the XML file
  
          File file=new File("/mnt/sdcard/xmldata.xml");
          FileInputStream fin=null;
          if(file.isFile())
              {
              try
              {
               fin=new FileInputStream(file);
              }catch(Exception e)
              {
  
              }
  
              }
          dom = db.parse(fin);
          flag =  parseDocument();
  
              // from this I am getting last xml value "stop" then it returns    
                        true and from while loop I am exited..
  
      }catch(ParserConfigurationException pce) {
          //pce.printStackTrace();
      }catch(SAXException se) {
          //se.printStackTrace();
      }catch(IOException ioe) {
          //ioe.printStackTrace();
      }
            return flag;
  }
  </code></pre>
  
  <p>EDIT: In my mind I have three options,</p>
  
  <ol>
  <li>Using Pipe</li>
  <li>Socket Communication</li>
  <li>AIDL</li>
  </ol>
  
  <p>So which one is better and why?</p>
  
  <p>If Am going wrong then please guide me. Thanks</p>