You can use a regular Java resource
bundle<http://en.wikipedia.org/wiki/.properties>which can be fully localized.
They are a set of files ending with
.properties which you can use for storing the button coordinates for each
local.
Just create in one of your packages a set of files with the same base name
("ButtonCoords" for example), followed by an underscore and the locale like
"_en_US" or just "_en". The suffix is ".properties":
*ButtonCoords_en.properties:*
homeButton = 10,10,100,100
closeButton = 20,20, 200,200
...
*ButtonCoords_fr.properties:*
homeButton = 12,11,105,105
closeButton = 22,22, 201,201
...
Then you need to load that properties file with following code. Java
automatically takes care of picking the correct file for the currently set
locale:
ResourceBundle bundle =
> ResourceBundle.getBundle("path/to/package/ButtonCoords");
>
The retrieved bundle object will be something like a HashMap that maps
Strings ("homeButton", "closeButton") to their according values.
String coordsStr = bundle.getString("homeButton");
>
String[] coordsArray = coordsStr.split(",");
> int[] coords = new int[coordsArray.length];
> int i = 0;
>
> for(String coord : coordsArray) {
> coords[i++] = Integer.parseInt(coord.trim());
> }
>
Make sure to provide a default .properties file without a locale (name it
just ButtonCoords.properties) so there won't be an error when someone plays
your game with an unsupported locale.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en