Context.getResources().getString(int id).

so yes, you need to pass around a Context. i think android is deficient here. for example, i like to separate the data model from the UI classes. what if the data model needs a resource string? it can't use android's resource mechanism, it has to fall back to std java resource bundles ... unless you pollute the data model with UI classes.

the other deficiency (sorry, OT here) is that android doesn't allow dynamic resource keys. i tend to use this a lot when there are plugin classes that want to look up their resources based on their class, or some other unique ID.

On 10/18/09 2:48 AM, jax wrote:
I have made a regular class that needs to use string from the R class.

I have imported the R class into the activity and am able to access
all the variables.

My Question is, how do you convert them to string,

For example: If I access R.string.myString it will return as an int
not a String
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

  

--

Reply via email to