Android Question file.size sometimes = 0

andredamen

Active Member
Licensed User
Longtime User
I want to know the filesize of imagefiles I import. Sometimes the file.size says 0. But in my windows explorer I see the size of the imagefile is 2.750 kb.

How is that possible and what an I do?

Code: Copy
Private Sub IsImageFile (Name As String) As Boolean
    Dim n As String = Name.ToLowerCase
    Log("1 ---------------------------")
    Dim dummyfs As Int = File.Size(Main.DirRouteMap, Name)
    Log("filesize :  " & dummyfs)
    dummyfs=dummyfs/1024
    Log(Name)
    Log(" in kb : "& dummyfs)
    If dummyfs > 1500 Then 
        Log(">1500")
        Return False
    End If
    
    If n.EndsWith (".jpg") Or n.EndsWith (".png") Or n.EndsWith (".gif") Or n.EndsWith (".bmp") Then
        Return True
    Else
        Return False
    End If
    
End Sub

[\code]
 
Code: Copy
Log("Dir: " & Main.DirRouteMap)
Dim dummyfs As Int = File.Size(Main.DirRouteMap, Name)
Almost certainly, the two directories do not match.
I'm certain it is the same directory I look into with windows

in my log:

*** ---------------------------
/storage/emulated/0/Android/data/andredamen.speurtocht/files/bestanden\IMG_20211201_155404.jpg
/storage/emulated/0/Android/data/andredamen.speurtocht/files/bestanden
filesize : 0
IMG_20211201_155404.jpg
in kb : 0
*** ---------------------------
 
Upvote 0
Back
Top