Is there a way where i can stop the MediaPlayer automatically after 20 seconds?
Does the function seekTo(20) works?
Is there a way where i can stop the MediaPlayer automatically after 20 seconds?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you use seekTo(20) it will skip the song to 20 miliseconds, so that’s not what you need.
You can use Handler.postDelayed for this:
First you create a new Handler, than you call postDelayed() to execute a new Runnable object. If you want to use it to pause a mediaplayer, here’s a little example for you: