Tuesday, April 26, 2011

How to display an integer in a textview in Android

I know this is very basic, but still might be something people are looking for.

Let's say you create a textview object and create that text in your xml file, numbers will display with no problem. The problem comes in when you create an int variable and want to pass that value to your textview. Well, it can be done like this.

int myNumber = 55;

myText.setText(String.ValueOf(myNumber));


If you're interested in World War II trivia, my new iPhone game is for you. Click here to download.

No comments:

Post a Comment