Reputation: 493
Mono (Xamarin) Android application path, how do get? I found one way, it look like better I found
string path = "";
System.Collections.IDictionary vars = System.Environment.GetEnvironmentVariables();
foreach (System.Collections.DictionaryEntry entry in vars)
{
if (entry.Key.ToString().Contains("HOME"))
path = entry.Value.ToString();
}
Upvotes: 9
Views: 19175
Reputation: 6911
I think this is what you need. Give the local files root.
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData
and when you need get a file's full name you can do something like this:
string _fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "filename.txt");
Upvotes: 4
Reputation: 18789
In your Android application you could use:
// Documents folder
string documentsPath = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.Personal);
This will get you the path:
/data/data/YourAppName/files/
Upvotes: 16