javaandroidandroid-mediaplayerandroid-lifecycleandroid-thread

How to play song after X seconds from starting an activity


I'm creating an android application, i need a way to run song after some seconds from starting activity, by default the song starts directly after i open that activity. thank you for your help


Solution

  • you can use

     new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
               //your code
              }
            }, 10000);