Wednesday, September 14, 2011

[android-developers] retrieve resource string from plain class


Hello,

I would like to retrieve the value of a resource string from
a plain class that does not have a Context superclass. Is
this possible? I see the API:

http://developer.android.com/guide/topics/resources/string-resource.html

which do not list getString and getText as static methods.

I tried

String foo = (new Context()).getString(R.string.str_foo);

but it seems I cannot do this.

Any ideas?

John Goche

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