Wednesday, August 17, 2011

Re: [android-developers] Translation handling

On Wed, Aug 17, 2011 at 2:40 PM, Daniel Rindt <daniel.rindt@yoc.com> wrote:
> the regular way is like getString(R.string.my_cart); but i wan't to have it
> like: getString("my_cart"); because i just have the key.

Use getResources().getIdentifier() to convert the String into a
resource ID. This uses reflection under the covers, so please cache
the looked-up ID.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 3.9 Available!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment