• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

show multiple lines of text?

mathkid95

Newbie
Hello,

How do you use a TextView to show multiple lines of text in android?
I tried doing android:singleLine = "false" but that's not working

Here is my code


for(int i = 1; i <= 10; i++)
{
tv.setText("instant " + i + ": ");
}

so it should say

instant 1:
instant 2:
instant 3:
instant 4:
instant 5:
instant 6:
instant 7:
instant 8:
instant 9:
instant 10:

BUT, the emulator only showing

instant 10:


How can I achieve this? Thanks!
 
uh lol ^

just do this:

Edit: err sorry needed coffee before i wrote that.

full code:
Code:
String myString ="";

for ( int i=0; i <= 10; i++ )
{
    myString += "instant " + i + ":\n";
}

tv.setText(myString);

\n is the unix newline character
 
Back
Top Bottom