How to use Internal Storage of Android in Xamarin? -


i want able use android's internal storage. found code snippets like:

 string path = application.context.filesdir.path;  var filepath = path.combine(path, "test.txt");  system.io.file.writealltext(filepath, "hello world"); 

but not figure out application in here.

is there solution or different perspective? :)

use this:

string path = system.environment.getfolderpath(system.environment.specialfolder.personal); string filename = system.io.path.combine(path, "testfile.txt");  // write using (var streamwriter = new streamwriter(filename, true)) {     streamwriter.writeline(datetime.utcnow); }  // read using (var streamreader = new streamreader(filename)) {     string content = streamreader.readtoend();     system.diagnostics.debug.writeline(content); } 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -