Reputation: 25
Im developing an app who have an EditText for users input and an ImageView that im using like a button to save the content of the EditText when the user press it.
So, my problem is that i dont know how i can save the content of the EditText in the txt file who will be save inside the internal storage. Also i need to load the content of this txt file inside the EditText every time that the user opens the app.
Does any one can put me in the right way to do this ? thanks.
Upvotes: 0
Views: 1251
Reputation: 89127
using System.IO;
// build path
string path = Path.Combine((string)Android.OS.Environment.ExternalStorageDirectory, "My Folder Name", "My File Name");
// write to file
File.WriteAllText(path, MyEditControl.Text);
// read from file
string text = File.ReadAllText(path);
MyEditControl.Text = text;
Upvotes: 3