B4J Question B4XImageView1.Load(SubDir, myFile) - Directory Structure ?

KiloBravo

Active Member
Licensed User
Trying to figure out how to load a .png file. I used part of Erel's example code for B4XImageViewExample and someone's listfolders test.b4j program. Thanks! :)
K:\FlashCards\Example\B4XImageViewExample\B4J\Files
B4XImageView1.Load(File.DirAssets, "1.png")

This is just a simple program to show png files from screenshots of a video course I took to help me study.
The file structure on my PC is K:\AGC\lesson1\"multiple Screentshots.png" & K:\AGC\lesson2\"multiple Screentshots.png"
I wanted to select a SubDirectory of Screenshots for each Lesson and then scroll through each screen shot.

Each SubDirectory has mutiple screenshots... .
IE K:\AGC\Automation\Screenshot (659).png ... K:\AGC\Automation\Screenshot (660).png ... K:\AGC\Automation\Screenshot (661).png

I am using B4XImageView1.Load(SubDir, myFile)
The file location is built correctly. But I get an error when trying to load the file.
java.io.FileNotFoundException: K:\AGC\Automation\Screenshot (659).png (The filename, directory name, or volume label syntax is incorrect)
I could move all the individual screenshots to the files folder of the project. But I have 300+ screenshot and wanted to keep them separated by the Sub Directories.

I checked the forums and could not find out how to keep/use a Sub Directory structure in the Files Section of the B4J Project. Or load each one directly from my hard drive.

Hopefully this makes sense. Any one know what I am doing wrong ?
 

KiloBravo

Active Member
Licensed User
Just a quick thought: try your program with filenames without spaces

Thanks, I did. I also tried k: and K: and reversing the / and \ and any other variations I can think of.
Going back to the Basic Example Erel gave for B4XImageViewExample.

The below files work in that example. I am going to try and add a SubDirectory to Erel's example and see if I can get that to work.

B4XImageView1.Load(File.DirAssets, "Screenshot (462).png")
B4XImageView2.Load(File.DirAssets, "Screenshot (463).png")
B4XImageView2.Load(File.DirAssets, "Screenshot (464).png")
 
Upvote 0

KiloBravo

Active Member
Licensed User
*
So that solution seems to work but I do get a warning message. ?
*
B4XMainPage - 26: File 'EC2/Screenshot (59).png' is missing from the Files tab. (warning #17)
B4XMainPage - 27: File 'EC2/Screenshot (60).png' is missing from the Files tab. (warning #17)
*
I am using ...
*
B4XImageView1.Load(File.DirAssets, "EC2/Screenshot (59).png")
B4XImageView2.Load(File.DirAssets, "EC2/Screenshot (60).png")
*
NOT ... fx.LoadImage(File.DirAssets, "test/smiley.png") 'test is a folder under the Files folder in the jar.
 
Upvote 0
Top