I tried your code, it looks like this:
[CODE lang="b4x" title="B4A"] Dim Dir As List=File.ListFiles(File.DirAssets)
For Each Element As String In Dir
Log("Asset DIR=" & Element)
Next
Dir = File.ListFiles(File.DirInternal)
For Each Element As String In Dir
Log("Internal DIR=" & Element)
Next
Dir = File.ListFiles(File.DirRootExternal)
For Each Element As String In Dir
Log("Root 1 DIR=" & Element)
Next
Dim rp As RuntimePermissions
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Res As Boolean)
** If Res = False Then
** Return
End If
Dir = File.ListFiles(File.DirRootExternal)
For Each Element As String In Dir
** Log("Root 2 DIR=" & Element)
Next
[/CODE]
The PermissionResult looks like
[CODE lang="b4x" title="B4A"]
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
If Permission = Starter.rp.PERMISSION_ACCESS_COARSE_LOCATION Then
Result = True
Log ( "PERMISSION_ACCESS_COARSE_LOCATION" )
Else If Permission = Starter.rp.PERMISSION_ACCESS_FINE_LOCATION Then
Result = True
Log ( "PERMISSION_ACCESS_FINE_LOCATION" )
Else If Permission = Starter.rp.PERMISSION_READ_EXTERNAL_STORAGE Then
Result = True
Log ( "PERMISSION_READ_EXTERNAL_STORAGE" )
Else If Permission = Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE Then
Result = True
Log ( "PERMISSION_WRITE_EXTERNAL_STORAGE" )
End If
B4XPages.Delegate.Activity_PermissionResult(Permission, Result)
End Sub
[/CODE]
I got a long list of filenames, but I see only "Root 1" not "Root 2", Asset, Internal is ok..
I set some breakpoints at "**" (see code above) but they where never reached ...
And I do not get any dialog for permissions ... but I do not used a new project, I used my current one.