title: How to store a string to file in android java code and call it for parsing in javascript
body: <p>I am trying to implement a jQuery Mobile application in which I am parsing an HTML code of a page to find only content of a div using div-id (in example main-content-inner). I am doing so in JavaScript which is stored in my index.html code as follows:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      window.onload = function() {
          //    var chck = document.getElementById("check");
          //     alert(chck.title);    
          $.ajax({
              type: 'GET',
              url: 'main.html',
              dataType: 'html',
              success: function(data) {
  
                  //cross platform xml object creation from w3schools
                  try //Internet Explorer
                  {
                      xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                      xmlDoc.async = "false";
                      xmlDoc.loadXML(data);
                  } catch (e) {
                      try // Firefox, Mozilla, Opera, etc.
                      {
                          parser = new DOMParser();
                          xmlDoc = parser.parseFromString(data, "text/xml");
                      } catch (e) {
                          alert(e.message);
                          return;
                      }
                  }
                  //    var chck = document.getElementById("check");
                  //    alert(chck.title);
                  var abc = document.getElementById("content1");
                  abc.innerHTML = (xmlDoc.getElementById("main-content-inner").innerHTML);
                  //    alert(abc.innerHTML);
              }
          });
  &lt;/script&gt;
  </code></pre>
  
  <p>As jQuery cant call the HTML code of a remote page (Same Origin Policy), I am using java language code which I am using implementing on MainActivity.java of android and the HTML code is returned as a string (say i).</p>
  
  <p>Now, I want to pass this "i" (from java) to javascript (in index.html) for parsing. What methods can I use to do that. Also I thought of storing the string in a file using FileWriter but I dont know how I can call the path of this new file in javascript (what to write in URL of JS).           </p>