Android Question Load Bitmap From Dir.Assets Bug?

cambopad

Active Member
Licensed User
Longtime User
Hi all

Today I try to load the bitmap which has a name like this "9o4RLEUFMno.jpg" from Dir.Assets. But it says the file doesn't exist with the following message:

B4X:
java.io.FileNotFoundException: 9o4rleufmno.jpg

In fact, this file do exist in the "Files" folder.
This is the codes I used to load the bitmap:
B4X:
Dim mybmp As Bitmap=LoadBitmap(File.DirAssets,"9o4RLEUFMno.jpg")

The error message seems to return the file name in lowercase!

So is it a must to name the files to be placed in "Files" folder in lowercase?
 

eurojam

Well-Known Member
Licensed User
Longtime User
You should add the file to the File Manager before using it. Filenames are case sensitive
 
Upvote 0

cambopad

Active Member
Licensed User
Longtime User
You should add the file to the File Manager before using it. Filenames are case sensitive
Thanks you ! I have a lot of files to be added to "Files" folder, so I rarely use File Manager to add them. I know the file names are case sensitive as the Android OS itself treats upper case and lower case name differently.
 
Upvote 0

cambopad

Active Member
Licensed User
Longtime User
All files in the "Files" folder should have only lowercase names, otherwise it may not found.
I really wonder about this because I used to have many files with Uppercase letters in their names, but the file can be found correctly!
 
Upvote 0

cambopad

Active Member
Licensed User
Longtime User
The IDE automatically changes the case of asset files to lower case. The same thing happens when you load the file at runtime. The string is converted to lower case.

Just click on the Sync button in the files tab and it will work properly.
Oh I see! Thanks you Erel!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…