I have an XML setting file for my android application. When application is published it has some default values that have to published with app. And after changing settings by user the value of this setting file has to be changed. I use an XML asset file to implement this feature. This file has some default values. And by publishing an app, it's also copied in device. But when I write to this file and come back it seems that the file was never changed. I use a file manager and look to my file on the device and see that this file had never been changed and have it has default values. I'm using monondroid and this is the code that I use for writing in my xmlsetting file:
public bool writeToFile (string newXmlContent)
{
try {
Stream sw= Application .Context .OpenFileOutput (AppConstants .xmlSettingFileName ,
FileCreationMode .Private );
StreamWriter stw= new StreamWriter (sw);
stw.Write (newXmlContent );
stw.Flush ();
XmlContent = newXmlContent ;
stw.Close ();
sw=null;
return true;
} catch (Exception ex) {
Common .HandleException (ex);
return false ;
}
}
What's wrong with this?