AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Android Get real path

Ein Thema von danten · begonnen am 15. Jul 2019 · letzter Beitrag vom 18. Jul 2019
Antwort Antwort
danten

Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
 
Delphi 10.1 Berlin Architect
 
#1

Android Get real path

  Alt 15. Jul 2019, 09:24
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
Daniel

Geändert von danten (15. Jul 2019 um 09:30 Uhr)
  Mit Zitat antworten Zitat
bra

Registriert seit: 20. Jan 2015
711 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#2

AW: Android Get real path

  Alt 17. Jul 2019, 09:21
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.
  Mit Zitat antworten Zitat
danten

Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
 
Delphi 10.1 Berlin Architect
 
#3

AW: Android Get real path

  Alt 18. Jul 2019, 07:50
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.
Daniel
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:32 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