Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Cross-Platform-Entwicklung (https://www.delphipraxis.net/91-cross-platform-entwicklung/)
-   -   Delphi Android Get real path (https://www.delphipraxis.net/201352-android-get-real-path.html)

danten 15. Jul 2019 09:24

Android Get real path
 
Hello to everybody,
I need to get a real path to the file as ParamStr (1).
Now I get the file path as follows: /external/file/11608
I need to get the file path: /external/documents/mytext.txt

My code:
Delphi-Quellcode:
procedure TfrmMain.FormCreate(Sender: TObject);
var
  intent: JIntent;
  param_intent: Jnet_Uri;
  param_str: String;
begin

  intent := SharedActivity.getIntent;
  if intent <> nil then
  begin
    if TJIntent.JavaClass.ACTION_VIEW.equals(intent.getAction) then
    begin
      param_intent:= intent.getData;
      param_str:= JStringToString(param_intent.getEncodedPath.toString);
      Label4.Text := param_str;
    end;
  end;
end;
Thank you

bra 17. Jul 2019 09:21

AW: Android Get real path
 
Thats not an easy one... here ist some example in Java, how to get the real filename:

https://www.dev2qa.com/how-to-get-re...m-android-uri/

But you also might need to get the content through a stream, as the real path might be unreachable for your app.

danten 18. Jul 2019 07:50

AW: Android Get real path
 
Thank you.
Everything is always so complicated.
I don't understand why Delphi contains features and procedures that don't do anything?
I do not access the system folders and need to process the file.


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:14 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz