String resource weirdness

For reasons I wont go into here, I want to define a string value that
is ignored by the SCM. So I added a file to the res/values directory.

For example, I add a file res/values/foo.xml which contains:

<?xml version="1.0" encoding="utf-8"?> Hello!

But when I do this and compile, the labels on the buttons on the main
menu are messed up, as if the wrong string resources are getting
assigned to them. e.g. the Manage Forms button now reads 'ODK Collect
v1.1.7RC1', etc.

Anyone know why this might be happening?

Have you tried to clean/build all ?

Since the ...R class has numeric values for all the resources, it may just
be that the new file gets assigned numeric resources before the strings.xml
does and you need to clean and rebuild to update the old index values in the
compiled code.

In other UI frameworks (e.g., Windows), if there are multiple resource
files, you need to set a numeric baseline or offset value for the resources
in a file so that the framework can assign those resources (strings) the
values base, base+1, base+2, etc. and not reuse the values across files.
Never tried this on Android.

Mitch

··· On Fri, Aug 19, 2011 at 9:26 AM, Thomas Smyth wrote:

For reasons I wont go into here, I want to define a string value that
is ignored by the SCM. So I added a file to the res/values directory.

For example, I add a file res/values/foo.xml which contains:

<?xml version="1.0" encoding="utf-8"?> Hello!

But when I do this and compile, the labels on the buttons on the main
menu are messed up, as if the wrong string resources are getting
assigned to them. e.g. the Manage Forms button now reads 'ODK Collect
v1.1.7RC1', etc.

Anyone know why this might be happening?

--
Mitch Sundt
Software Engineer


University of Washington
mitchellsundt@gmail.com

Brilliant, that fixed it. Thanks.

··· On 19 August 2011 13:10, Mitch Sundt wrote: > Have you tried to clean/build all ? > > Since the ...R class has numeric values for all the resources, it may just > be that the new file gets assigned numeric resources before the strings.xml > does and you need to clean and rebuild to update the old index values in the > compiled code. > > In other UI frameworks (e.g., Windows), if there are multiple resource > files, you need to set a numeric baseline or offset value for the resources > in a file so that the framework can assign those resources (strings) the > values base, base+1, base+2, etc. and not reuse the values across files. > Never tried this on Android. > > Mitch > > On Fri, Aug 19, 2011 at 9:26 AM, Thomas Smyth wrote: >> >> For reasons I wont go into here, I want to define a string value that >> is ignored by the SCM. So I added a file to the res/values directory. >> >> For example, I add a file res/values/foo.xml which contains: >> >> <?xml version="1.0" encoding="utf-8"?> >> >> Hello! >> >> >> But when I do this and compile, the labels on the buttons on the main >> menu are messed up, as if the wrong string resources are getting >> assigned to them. e.g. the Manage Forms button now reads 'ODK Collect >> v1.1.7RC1', etc. >> >> Anyone know why this might be happening? > > > > -- > Mitch Sundt > Software Engineer > http://www.OpenDataKit.org > University of Washington > mitchellsundt@gmail.com >