Please see the code below:
Jamie Coleshill wrote:First thing is where are you declaring your String mezok? The second thing is that you can not do .setText("") on a string or array of Strings, you must use the = sign as follows because as the ADT say's "The method setText(String) is undefined for the type String".
I have declared in onCreate. I would like to use this string as a textview id. How can I convert a string to a resource ID?
Kovacs Akos wrote:I would like to use this string as a textview id. How can I convert a string to a resource ID?
You can't, the ids are all integers. You can sort of work around it by using reflection to load the .R class for your application and searching for the variable name with the same name and getting its value. But it is slow and complex, and fragile. I would suggest a different approach - perhaps a Map<String,Integer> that you pre-fill with the Strings you want to the ID it represents.