In my program I am getting a string from Database result set and convert it to char array like this:
emp.nid = rs.getString("nid").toCharArray();
In this part there is no error. The String is successfully converted to char array.
But I have another code like this:
nid_txt.setText(emp.nid.toString());
This prints some freaky text. Not the original. Why was this happens? Please help me.
You’re calling
toStringon achar[]– and that inherits the implementation fromObject, so you get thechar[].classname, @ and then the hash of the object. Instead, call theString(char[])constructor: