Recent

Author Topic: How to load list of internal app file in jlistview ?  (Read 1175 times)

rsu333

  • Full Member
  • ***
  • Posts: 110
How to load list of internal app file in jlistview ?
« on: February 24, 2021, 03:59:45 pm »
Is it possible to load list of files present in internal app to jlistview ?
When using command
    self.getListoffiles
then how to display it in jlistview ?
.
Thank you.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: How to load list of internal app file in jlistview ?
« Reply #1 on: February 27, 2021, 03:55:47 am »
Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.jButton1Click(Sender: TObject);
  2. var
  3.   list: TDynArrayOfString;
  4.   count, i: integer;
  5. begin
  6.     list:= Self.GetFileList(Self.GetEnvironmentDirectoryPath(dirDownloads)); //or another dir
  7.     count:= Length(list);
  8.     for i:= 0 to count-1 do
  9.     begin
  10.        jListView1.Add(list[i]);
  11.     end;
  12.     SetLength(list, 0);  //free array
  13. end;
  14.  
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

rsu333

  • Full Member
  • ***
  • Posts: 110
Re: How to load list of internal app file in jlistview ?
« Reply #2 on: February 27, 2021, 07:53:12 am »
Thanks a lot. I will try it soon.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: How to load list of internal app file in jlistview ?
« Reply #3 on: February 27, 2021, 06:44:11 pm »

And don't forget:  you need request  "user permission" to read and write files informations ...
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018