Hi all,
First i'm sorry for my bad english but i will try to speak correctly.
So i have problem when i do a streamwriter, he don't create a file.
so now i give code :
this is for get path :
`var folder = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
var filename = Path.Combine (folder, "test.csv");
return filename;`
here i try so much things like Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
my class for file :
`using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
namespace CEADetectGaz
{
public class CsvFile
{
const string SEPARATOR = @;;
const string GUILLEMET = "\"";
public StreamWriter write;
public TimeSpan Timer { get; set; }
public int Red{ get; set; }
public int Green{ get; set; }
public int Blue{ get; set; }
private CsvFile m;
public CsvFile ()
{
var a = G.uitools.GetPath ();
MemoryStream mstrm = new MemoryStream(Encoding.UTF8.GetBytes(G.uitools.GetPath()));
write = new StreamWriter (mstrm);
}
public void AddLines( LinkedList<string> list)
{
foreach (var elements in list) {
write.Write (GUILLEMET);
write.Write (elements);
write.Write (GUILLEMET);
write.Write (SEPARATOR);
}
}
}
}
`
Now my function for fill my file :
` public async Task ExportToCSV ()
{
lock (lockflag) {
var rediter = redvalues.GetEnumerator ();
var greeniter = greenvalues.GetEnumerator ();
var blueiter = bluevalues.GetEnumerator ();
for (int i = 0; i < redvalues.Count; i++) {
//write CSV
rediter.MoveNext ();
greeniter.MoveNext ();
blueiter.MoveNext ();
linevalues.AddLast (rediter.Current.X.ToString ());
linevalues.AddLast(rediter.Current.Y.ToString ());
linevalues.AddLast(greeniter.Current.Y.ToString ());
linevalues.AddLast(blueiter.Current.Y.ToString ());
csv.AddLines (linevalues);
linevalues.Clear();
}
}`
And now my call :
graphmanager.ExportToCSV ();
So i don't know where i my error but it's my fist time with file manage .
Thanks for all people give me time .