You must try a bit with Environment.SpecialFolder, it has the entire path
for your application. For example, SpecialFolder.Personal is the place for
read/write files.
To see what they make let MonoDevelop or VisualStudio show you all
SpecialFolder enumerations writing it some place to see, like
Environment.GetFolderPath(Environment.SpecialFolder.Personal)

Karl

From:  Jerry Paxton <jerrypax...@gmail.com>
Reply-To:  "monodroid@lists.ximian.com" <monodroid@lists.ximian.com>
Date:  Thu, 19 May 2011 14:16:15 -0700
To:  "monodroid@lists.ximian.com" <monodroid@lists.ximian.com>
Subject:  [mono-android] First Prog - Issue Opening XML in Resources
Directory

Hey all, this is my first MonoDroid program and I was wondering how to
properly access a file on my Android mobile device. I have an xml file in
the Resources/xml folder structure and need to open it up for parsing in my
program.

try
{
  System.IO.StreamReader streamReader = new
System.IO.StreamReader("myorders.xml");
  System.Xml.XmlDocument document = new System.Xml.XmlDocument();
  document.Load(streamReader);

foreach (System.Xml.XmlNode currentNode in document.ChildNodes)
{
  Android.Util.Log.Info <http://Android.Util.Log.Info> ("Node",
currentNode.InnerText);
}
}
catch (Exception exception)
{
  Android.Util.Log.Info <http://Android.Util.Log.Info> ("Exception",
exception.Message);
}

Now, I think my biggest issue is what to put in the StreamReader path.
"Resources\\xml\\myorders.xml" does not seem to work. I am definitely
missing something in how to access the device file system. Any hints?

Cheers and thanks!
-JP
_______________________________________________ Monodroid mailing list
Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to