user3603321
user3603321

Reputation: 39

Visibility ripple effect

I have two elements in my activity layout that are set with VISIBILITY=GONE, that I want to make appear one after the other, with a delay of 500 milliseconds. Each time one of them appears i also want to play a sound, however, using a runnable thread on the UI results in sounds playing with the right delay, and both the screen elements appearing at the same time. What is the correct way to do this?

Upvotes: 0

Views: 784

Answers (1)

Pawan asati
Pawan asati

Reputation: 292

Use this code:

Handler handler = new Handler();
handler.postDelayed(new Runnable() {
     public void run() {
         //write the code here which you want to run after 500 milliseconds
     }
}, 500);

Upvotes: 3

Related Questions