Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Turn textView into a log output

Tags:

java

android

I have textView that I would like to turn into a simple log of what stage of a loop the program is currently in.

For example if I press a button:

public void doThis(View view) {
        for (int j = 1; j <= 10; j++) {
my_text.setText(j+"");          
        }
    }

This overwrites the text in the textView though. How would I go about creating something where the textView would say:

1
2
3
4
5
6
7
8
9
10
like image 816
EGHDK Avatar asked May 13 '26 19:05

EGHDK


1 Answers

You can append text my_text.append(j+"\n");

like image 141
Hoan Nguyen Avatar answered May 16 '26 09:05

Hoan Nguyen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!