How do I convert a string representation of an integer to a string in Java? -


i'm using contentresolver query data database in android. that's not issue.

the method returns string representation of integers,

int type_main = 2 

i want convert string type_main

string = somemagicalmethod(type_main); system.out.println(a); 

such output be

type_main 

i can't use integer.tostring(type_main) because return value of 2

how can achieve this?

in java, cannot inspect values of variables using name, info not available @ run time, not through reflection. use map<string, integer> solve problem:

map<string, integer> map = new hashmap<>(); map.put("type_main", 2); //... string = map.get("type_main").tostring(); //somemagicalmethod(type_main); system.out.println(a); //prints 2 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -