1

I am working on qt 5.14.1 with ndk version 21 and sdk version 28. I want to open a kml file using file dialog in qt android. I get a fileurl from file dialog like this,

content://com.android.externalstorage.documents/document/primary%3Adocuments%2FAeroGCS%2FAeroGCSWorkspace%2FAbc5%2FBbb%2FBbb.kml

but I didn't know how to convert this URL into a simple path and read the data from the file. Please tell me how can I convert this URL into a proper android path.

  • 1
    "I didnt know how to convert this url into simple path" -- you can't, in large part because it might not be a file. See https://stackoverflow.com/q/59123162/115145 and https://stackoverflow.com/q/49221312/115145 for more, though most of the material on this subject is based around traditional Java/Kotlin Android app development. – CommonsWare Sep 30 '20 at 10:58
  • Pretty simple as all on com.android.externalstorage points directly to a file. You see `AeroGCS%2FAeroGCSWorkspace%2FAbc5%2FBbb%2FBbb.kml` on primary. That is `AeroGCS/AeroGCSWorkspace/Abc5/Bbb/Bbb.kml` on external storage root. Hence `/storage/emulated/0/AeroGCS/AeroGCSWorkspace/Abc5/Bbb/Bbb.kml` – blackapps Sep 30 '20 at 13:58
  • But... You do not need such a path as you can read the file using the obtained uri direcyly. – blackapps Sep 30 '20 at 14:02
  • 1
    yes I know the path but how can I convert that url into proper file path to open a file. – Hemant Suryawanshi Oct 01 '20 at 05:12
  • or as you mentioned, how can I read file using url directly. – Hemant Suryawanshi Oct 01 '20 at 05:19

0 Answers0