views:

59

answers:

2

the code is

Field field = st.class.getField("g_"+selectedGroup);

st is my class, and g_+"selectedgroup" is in the st class as String array

how to get that string array?

I need something: String sa[]= field.getStringArray[]; but only getInt, getBoolean there is :(

how to?

+1  A: 

You just use get.

field.get(instance);

If it's a static field, instance can be null (or really anything).

Matthew Flaschen
You are right, I made a very silly mistake. Now corrected. +1
Adeel Ansari
+1  A: 

Try this,

Field field = ST.class.getField("g_"+selectedGroup);
String[] sa = (String[])field.get(stInstance);

Where stInstance is an instance of ST class.

Adeel Ansari