Many applications require access to a persistent storage. The two most common storage types are files and databases. We will cover text files in this tutorial. The predefined Files object has several utility methods for working with text files which are pretty easy to use. Files locations -...
File.WriteString(File.DirData("MyApp"), "Text.txt", TextArea1.Text) 'write text to file
TextArea1.Text = File.ReadString(File.DirData("MyApp"), "Text.txt") 'read text from file
You could also use KeyValueStore (Internal lib) ... It is very simple to use and can store much more in single database (App settings, maps, lists etc)
B4X:
Private KVS As KeyValueStore 'Process_Global
KVS.Initialize(File.DirData("MyApp"), "datastore.db") 'App Start
KVS.Put("TextArea1 Contents", TextArea1.Text) 'write data
'If KVS.ContainsKey("TextArea1 Contents") Then
TextArea1.Text = KVS.Get("TextArea1 Contents") 'get the data ... (your choice to check that key exists first.)
'End If