I would suggest to use reflection in that case.
Just look for a field from "R.string" class named "h" + desiredString
and pass it's value to textView.setText()

Note that reflection is slower than direct access.

On Oct 24, 7:48 am, David <dmackle...@gmail.com> wrote:
> @Farpoc
>
> Your solution worked perfectly.  Thank you very much.  I have about
> 300 possible strings the user can choose.  Is there a less CPU
> intensive way to do this without 300 else if statements?
>
> If not, hey, the application works well enough.  But it would be
> cleaner code if it were possible to use R.string.h + whatever the user
> entered on prior screen.  Is this possible?

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