2
In my application in Delphi I am creating a simple text file on Android, using the following code:
var lst: TStringList;
begin
lst := TStringList.Create;
lst.Clear;
lst.Add('a');
lst.Add('b');
lst.Add('c');
lst.Add('d');
// Esse path é: /data/data/com.embarcadero.MyApp/files/test.txt
if not TFile.Exists(System.IOUtils.TPath.Combine(System.IOUtils.tpath.getdocumentspath,'test.txt')) then
lst.SaveToFile(System.IOUtils.TPath.Combine(System.IOUtils.tpath.getdocumentspath,'test.txt'));
And I see through Debug that the file is created. When I run for the second time the if not TFile.Exists
also detects that the file already exists.
PROBLEMS:
1) When I try to find the file test.txt
on Android, even I find this directory "/data/data/...";
2) I don’t know is possible on Android, but I would like to save this file in the same program installation folder. In projects with Delphi VCL I used as reference the path of the executable Application.ExeName
, that on Android is not compatible. It is possible/indicated to do this on Android?
The problem is that new versions of Android does not allow you to access some folders
– Antonio Carlos Amaral