Could you not use the StringBuffer class to append the into to the string? Then just put the String variable in the dialogbox, instead of calling a method?

Like this:

String x = new...