loadConfig in android

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

elivnat70
Posts: 3
Joined: 06 Aug 2012, 15:02

loadConfig in android

Postby elivnat70 » 02 Oct 2012, 05:46

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
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: loadConfig in android

Postby Lapo » 02 Oct 2012, 08:21

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:

Code: Select all

System.out.println(new File(".").getAbsolutePath());


Then you can deduce the correct relative path of the external config file.
Lapo
--
gotoAndPlay()
...addicted to flash games
elivnat70
Posts: 3
Joined: 06 Aug 2012, 15:02

Re: loadConfig in android

Postby elivnat70 » 02 Oct 2012, 17:46

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
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: loadConfig in android

Postby Lapo » 02 Oct 2012, 17:52

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.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 22 guests