Android Question File.Exists Does not work with Asset directories

Devv

Active Member
Licensed User
Longtime User
This code will set the image without any error
B4X:
ImageView_LeftItem.SetBackgroundImage(LoadBitmap(File.DirAssets,"categories/" & tag1 & ".png"))


while this code returns false

B4X:
log(File.Exists(File.DirAssets,"categories/" & tag1 & ".png"))

i'am confused why the app cant check files inside folders in assets but can load them !

note: the file does exist in the assets folder
 

DonManfred

Expert
Licensed User
Longtime User
File.Exists does not work with Files in Assets.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
subfolder are not supported by b4a.
It does work and the files are inside the apk. But you can not use any File.Exists on any of the subfolders files.

Create a txt file with all the content (including subfolders) and put it in assets. Use the txt list then to check if a file is available.
 
Upvote 0

ac9ts

Active Member
Licensed User
Longtime User
Since the asset folder is part of the app when you package it, you should already know what's in it.
 
Upvote 0
Top