Are you trying to replace a text inside a text with an int (or boolean)? Just run #toString() on the int or boolean.
Rather use String#valueOf(), ints and booleans don't have #toString() unless you're using the classes I believe