There are old post about loadConfig path issues with configuration file in java code in android.
We use an XML file successfully in iOS platform, but when trying to use the same file,
no matter which path I got error in logcat 'cannot open the file....'
Did anybody find the reason why java code is not been able to open the configuration file or why the loadConfig is not working with java code in android emulator or device?
Any help will be appreciated for this old problem.
Thank you.
Elik
loadConfig in android
Re: loadConfig in android
I think it depends on how Android set the current file path, which is relative to the config file.
You could do a little test and see what is the current path by using this:
Then you can deduce the correct relative path of the external config file.
You could do a little test and see what is the current path by using this:
Code: Select all
System.out.println(new File(".").getAbsolutePath());
Then you can deduce the correct relative path of the external config file.
Re: loadConfig in android
Thank for the advice but it does not work.
I've tried it and got the absolute path as well as getting path through view but nothing is working.
Are you sure that loadConfig take into consideration that the config file is packed as part of apk in android, and loadConfig cannot open it since it has to unpack it ?
I'm still looking if anybody has a successful use of loadConfig opening config file in assets in android app.
Thank you.
Elik
I've tried it and got the absolute path as well as getting path through view but nothing is working.
Are you sure that loadConfig take into consideration that the config file is packed as part of apk in android, and loadConfig cannot open it since it has to unpack it ?
I'm still looking if anybody has a successful use of loadConfig opening config file in assets in android app.
Thank you.
Elik
Re: loadConfig in android
Are you sure that loadConfig take into consideration that the config file is packed as part of apk in android, and loadConfig cannot open it since it has to unpack it ?
No it doesn't. It needs the file in the regular filesystem.
Return to “SFS2X Java / Android API”
Who is online
Users browsing this forum: No registered users and 22 guests