N
N
Nikita2017-10-02 21:11:30
Java
Nikita, 2017-10-02 21:11:30

How to make deletion (or any action) of textview on a timer?

It is necessary to delete the element 10 seconds after its creation.

Timer timer = new Timer();
        myLayout.addView(textView);
        timer.schedule(myLayout.removeView(textView),0,2000); //тут студия выдает что нужно void туда вставлять

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tiberal, 2017-10-02
@NeToster

Handler.postDelayed(java.lang.Runnable, long)
View.postDelayed(java.lang.Runnable, long)
don't forget to call removeCallbacks(Runnable action). So that the memory does not flow.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question