title: XmlReader on Android
body: <p>I have a problem with my XmlReader.
  The thing is that reader is reading webpage only 2 times, but i need a little more..
  If I call my reader from method : </p>
  
  <pre><code>public string Meth1()
      {
          string tvcal = "";
          string url = "http://www.nbrb.by/Services/XmlExRates.aspx?ondate=" + dtp1.ToString("MM/dd/yyyy");
          XmlReader reader = XmlReader.Create(url);
          while (reader.Read())
          {
              if (reader.Name.Equals("Currency"))
              {
                  reader.MoveToFirstAttribute();
                  try
                  {
                      if (Int32.Parse(reader.Value) == 145)
                      {
                          reader.ReadToFollowing("CharCode");
                          currencyUSD = reader.ReadElementContentAsString();
                          reader.ReadToFollowing("Name");
                          currencyUSD += " " + reader.ReadElementContentAsString();
                          reader.ReadToFollowing("Rate");
                          currencyUSD += " " + reader.ReadElementContentAsString() + " руб.\n";
  
                          tvcal += ("На Дату------" + dtp1.ToShortDateString() + "------\n");
                          tvcal += (currencyUSD);
                      }
                      if (Int32.Parse(reader.Value) == 19)
                      {
                          reader.ReadToFollowing("CharCode");
                          currencyEUR = reader.ReadElementContentAsString();
                          reader.ReadToFollowing("Name");
                          currencyEUR += " " + reader.ReadElementContentAsString();
                          reader.ReadToFollowing("Rate");
                          currencyEUR += " " + reader.ReadElementContentAsString() + " руб.\n";
  
                          tvcal += (currencyEUR);
                      }
                      if (Int32.Parse(reader.Value) == 190)
                      {
                          reader.ReadToFollowing("CharCode");
                          currencyRUR = reader.ReadElementContentAsString();
                          reader.ReadToFollowing("Name");
                          currencyRUR += " " + reader.ReadElementContentAsString();
                          reader.ReadToFollowing("Rate");
                          currencyRUR += " " + reader.ReadElementContentAsString() + " руб.\n";
  
                          tvcal += (currencyRUR);
                          break;
                      }
                  }
                  catch { }
              }
          }
          return tvcal;
      }
  </code></pre>
  
  <p>it is compiling, and everything is fine, then if I call it again it still works a returns me result.
  But if i try to call it third time it brakes with no errors here:<code>while (reader.Read())</code>
  Another problem with that reader hapend, when i try to call enother class to use reader in there.
  Firs i call method <code>Meth1</code> in my class, it gives me result, then i call another class wich contains 2 methods like <code>Meth1</code>, they do the saim job, but for static date. And in the moment when compiling is coming to <code>while (reader.Read())</code> in the second method of other class (the third object of XmlReader) it sends hendle back to android application and it brakes after several seconds.</p>
  
  <p>I have searched for such problem, but found nothing.
  Another application, wich is running on Windows is working correctly with simmilar classes and methods.</p>