How to find and open . txt file, add info and save? Inside Android

Asked

Viewed 539 times

3

I’m using Delphi Berlin 10.1. I could not use Opendialog, it simply does not open inside Android.

I searched the root of the android that is in /Storage/Emulated/0/ where I should find a file .txt The same procedure for Win32 Desktop is ok.


I managed to get the file.

procedure TF_form1.FileSearch(PathName, FileName: string; const InDir: boolean);
var
  Rec: TSearchRec;
  path: string;
  LItem: TListViewItem;
begin
  path := IncludeTrailingBackslash(PathName);
  if FindFirst(path + FileName, faAnyFile - faDirectory, Rec) = 0 then
      repeat
        LItem := ListView.Items.Add;
        LItem.Text := path + Rec.Name;
      until FindNext(Rec) <> 0;


  If not InDir then
  begin
    TabControl.TabIndex := 0;
    exit;
  end;

  if FindFirst(path + '*.*', faDirectory, Rec) = 0 then
      repeat
        if ((Rec.Attr and faDirectory) <> 0) and (Rec.Name <> '.') and (Rec.Name <> '..') then
          FileSearch(path + Rec.Name, FileName, true);
      until FindNext(Rec) <> 0;
end;

But I haven’t been able to use Opendialog yet. If you have something similar, let me know.

  • Opendialog serves only for Win32/64 and OS-X. You can use "Jfiledialog" on android. Or access this link that has an example implementation: http://bluexmas.tistory.com/427

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.