Domanda

How do I list files in SD card path and internal memory path?

I've tried FindFile with GetDocumentsPath as the parameter and i have no luck.

Ouch, where can I find more documentation or code snippets for Delphi for Android?

È stato utile?

Soluzione

Add System.IOUtils to your uses clause. You can then use code TPath and TDirectory something like this:

uses
  System.IOUtils, System.Types;

procedure TForm1.Button1Click(Sender: TObject);
var
  FileList: TStringDynArray;
  DocDir: string;
  s: string;
begin
  Memo1.Lines.Clear;
  DocDir := TPath.GetDocumentsPath;
  FileList := TDirectory.GetFiles(DocDir);
  for s in FileList do
    Memo1.Lines.Add(s);
end;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top