user3679942
user3679942

Reputation: 17

Android TextSwitcher: how to make every text stay?

In my app I have following code:

    tw.setText("1");
    tw.setText("2");

I thought it will let 1 stay for a while and then display 2, but in fact, It only display 2, is there any way to fix this?

Upvotes: 1

Views: 70

Answers (1)

M D
M D

Reputation: 47817

I guess you want to replace TextView text. Then try this way

    Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    tw.setText("2");
                }
            }, 4000);

Upvotes: 2

Related Questions