Android Question TargetSdkVersion from 19 to 26 some commands don't work

Urishev

Member
Licensed User
When moving targetSdkVersion from 19 to 26, the following code stopped working:
Sub ListFiles
Dim list_files As List
list_files.Initialize
File.MakeDir(File.DirRootExternal, "Text/")
dir=File.Combine(File.DirRootExternal,"Text/")
list_files=File.ListFiles(dir)
For i= list_files.Size -1 To 0 Step -1 ' error "(List) Not initialized"
If i = list_files.Size-Selected-1 Then
Filename = "ECG_Reader/" & list_files.Get(list_files.Size-Selected-1)
ListView1.AddTwoLines(list_files.Get(list_files.Size-Selected-1),"")
End if
End Sub

How to fix?
 
Last edited:

DonManfred

Expert
Licensed User
Last edited:

Urishev

Member
Licensed User
In targetSdkVersion 26, this code does not work. What need to do?
B4X:
Sub ListFiles
  Dim list_files As List
    list_files.Initialize   
    File.MakeDir(File.DirRootExternal, "ECG_Reader/")
    dir=File.Combine(File.DirRootExternal,"ECG_Reader/")
    list_files=File.ListFiles(dir)
    For i= list_files.Size -1 To 0 Step -1 ' error "(List) Not initialized"
       If i = list_files.Size-Selected-1 Then       
         Filename = "ECG_Reader/" & list_files.Get(list_files.Size-Selected-1)
         ListView1.AddTwoLines(list_files.Get(list_files.Size-Selected-1),"")
      End if
End Sub
 

mw71

Active Member
Licensed User
have you check the (Runtime) permission to read from memory? (see Post #2)
 

Urishev

Member
Licensed User
How to use (Runtime) permission? Put on the manifest?
Something hard. It used to be all easy.
 
Top