H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Aug 18, 2022 #1 Hi, what is the code of Inline java get asset folder path? Also what is about internal directory path? file1.csv found in asset folder. I got this error: Caused by: java.io.FileNotFoundException: AssetsDir/file1.csv (No such file or directory) Last edited: Aug 18, 2022
Hi, what is the code of Inline java get asset folder path? Also what is about internal directory path? file1.csv found in asset folder. I got this error: Caused by: java.io.FileNotFoundException: AssetsDir/file1.csv (No such file or directory)
agraham Expert Licensed User Longtime User Aug 18, 2022 #2 The asset folder is a virtual folder so you need to use the B4A File.DirAssets and specify it in conjunction with the B4A File object to access asset files. It would be mesyy to to do this in inline Java. For internal file paths use File.DirInternal etc. as strings and pass it to your Java code - though I don't see why you would need to do file operations in inline Java code. Upvote 0
The asset folder is a virtual folder so you need to use the B4A File.DirAssets and specify it in conjunction with the B4A File object to access asset files. It would be mesyy to to do this in inline Java. For internal file paths use File.DirInternal etc. as strings and pass it to your Java code - though I don't see why you would need to do file operations in inline Java code.
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Aug 18, 2022 #3 I have inline java code that require passing file as parameter. If i passing File.DirAssets & file name it throw above error! Upvote 0
I have inline java code that require passing file as parameter. If i passing File.DirAssets & file name it throw above error!
agraham Expert Licensed User Longtime User Aug 18, 2022 #4 Hamied Abou Hulaikah said: I have inline java code that require passing file as parameter Click to expand... Why can't you do file operations in B4X code? Upvote 0
Hamied Abou Hulaikah said: I have inline java code that require passing file as parameter Click to expand... Why can't you do file operations in B4X code?
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Aug 18, 2022 #5 I agraham said: Why can't you do file operations in B4X code? Click to expand... I'm using additional jar files that require file name parameter. Upvote 0
I agraham said: Why can't you do file operations in B4X code? Click to expand... I'm using additional jar files that require file name parameter.
DonManfred Expert Licensed User Longtime User Aug 18, 2022 #6 The assets folder is a virtual folder. Copy the file from File.DirAssets to File.Dirinternal first and then use the new path. Upvote 0
The assets folder is a virtual folder. Copy the file from File.DirAssets to File.Dirinternal first and then use the new path.
agraham Expert Licensed User Longtime User Aug 18, 2022 #7 You can't use asset files in that case without copying them from assets to a real file folder and passing that path to your jar. Upvote 0
You can't use asset files in that case without copying them from assets to a real file folder and passing that path to your jar.
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Aug 18, 2022 #8 DonManfred said: Copy the file from File.DirAssets to File.Dirinternal first and then use the new path. Click to expand... same error! Upvote 0
DonManfred said: Copy the file from File.DirAssets to File.Dirinternal first and then use the new path. Click to expand... same error!
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Aug 18, 2022 #9 agraham said: You can't use asset files in that case without copying them from assets to a real file folder and passing that path to your jar. Click to expand... Can you give us an example of that real path if file located in the root of device. Upvote 0
agraham said: You can't use asset files in that case without copying them from assets to a real file folder and passing that path to your jar. Click to expand... Can you give us an example of that real path if file located in the root of device.
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Aug 18, 2022 #11 Ok correct: /storage/emulated/0/file1.csv with grant permission Thanks Upvote 0
DonManfred Expert Licensed User Longtime User Aug 18, 2022 #12 Hamied Abou Hulaikah said: Ok correct: /storage/emulated/0/file1.csv with grant permission Click to expand... You app is on playstore? And you are using targetsdk 30 or higher? Upvote 0
Hamied Abou Hulaikah said: Ok correct: /storage/emulated/0/file1.csv with grant permission Click to expand... You app is on playstore? And you are using targetsdk 30 or higher?
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Aug 18, 2022 #13 DonManfred said: You app is on playstore? And you are using targetsdk 30 or higher? Click to expand... Not in playstore. It target 30+ Upvote 0
DonManfred said: You app is on playstore? And you are using targetsdk 30 or higher? Click to expand... Not in playstore. It target 30+
DonManfred Expert Licensed User Longtime User Aug 18, 2022 #14 Hamied Abou Hulaikah said: Not in playstore Click to expand... then set targetsdk to 26 and use runtimepermissions to get access to File.Dirrootexternal. Upvote 0
Hamied Abou Hulaikah said: Not in playstore Click to expand... then set targetsdk to 26 and use runtimepermissions to get access to File.Dirrootexternal.