'Android | AlertBuilder Getting String text from values + method

I want to display a text in Alert Dialog from Strings/string.xml and depending on the results within the app, an additional text.

string.xml

dialog_title = "Hello world"
dialog_message = "I am the text from string.xml"

my alert dialog

alertBuilder
              .setTitle(R.string.dialog_title)
              .setMessage(R.string.dialog_message + myClass.getText())
              .setCancelable(false)

my getText() method

public class myClass {
    public String getText() {      
    return "I am the text from the method" + "\n" + "I am a text from there, too"
    }
}

Output:

Hello world

21283932323

I am the text from the method

I am a text from there, too

__

Whats wrong here? Why am I getting a number instead of the text from string.xml?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source