Android Question [SOLVED] files in the Download folder with Filedialog?

javiers

Active Member
Licensed User
Longtime User
Hello, how can I access the files in the Download folder with Filedialog?


I use < Uses-android SDK: MinSdkVersion = "5 " android: TargetSdkVersion = "24 "/>

Dim FD As FileDialog
Fd. TextColor = colors. Black
Fd. FilePath =???????

Thank you!
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
I assume it would be something like:
B4X:
Fd.FilePath = $"${File.DirRootExternal}/Download"$

- Colin.
 
Upvote 0

javiers

Active Member
Licensed User
Longtime User
B4X:
Fd.FilePath = File.combine(File.DirRootExternal, "Download")

File path: /storage/emulated/0/Download

File path: /storage/emulated/0/Download

Thank you both. Both shapes set the path to the Download folder, but the dialog box does not display any files...
 

Attachments

  • Screenshot_20180129-062324.png
    Screenshot_20180129-062324.png
    79.3 KB · Views: 430
Upvote 0

javiers

Active Member
Licensed User
Longtime User
This is my Manifest:

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="24"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

AddManifestText(<uses-permission
 android:name="android.permission.WRITE_EXTERNAL_STORAGE"
 android:maxSdkVersion="18" />
)

AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)
AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="shared" />

I use Dialogs v4.01
 
Last edited:
Upvote 0

javiers

Active Member
Licensed User
Longtime User
As Manfred says, I think you need to either use runtime permissions (Runtime Permissions (Android 6.0+ Permissions)) or make your targetSdkVersion less than 23.

- Colin.

Solved. Thank you, everyone. It's a great forum.
I added the following line:

B4X:
Starter. Rp. CheckAndRequest (starter. Rp. PERMISSION_WRITE_EXTERNAL_STORAGE)


In Starter:

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Public rp As RuntimePermissions
...
End Sub
 
Upvote 0
Top