1
Answer

SAVE test file on external Storage of ANDROID Mobile PHONE XAMARIN c#

Android Version: 9;

Language used: C# in XAMARIN

i use this code:

string fileName = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "Test.txt");

//Pass the filepath and filename to the StreamWriter Constructor
StreamWriter sw = new StreamWriter(fileName);
//Write a line of text
sw.WriteLine("Hello World!!");
//Write a second line of text
sw.WriteLine("From the StreamWriter class");
//Close the file
sw.Close();

And get this error:

Android does not contain a definition for 'OS'

THANKS to everyone

Answers (1)