Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7018229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:01:08+00:00 2026-05-27T23:01:08+00:00

Hi guys Im trying to stop mediaplayer in certain point but it doesnt work

  • 0

Hi guys Im trying to stop mediaplayer in certain point but it doesnt work for me below is my code let me know what is wrong in this code.

int Str = 36000;
                int Stop = 51000;
                mediaPlayer.seekTo(Str);
                mediaPlayer.start();
                if(mediaPlayer.getCurrentPosition() == Stop)
                {
                    mediaPlayer.stop();
                }

Media player starts at the specified point and it continues to play, when I debug it, it comes to the if condition and it still continues to play no error(as far I know) is displayed, I played with while, if condition and debug line by line but cant figure out,Please help me Thanks for your time

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:01:08+00:00Added an answer on May 27, 2026 at 11:01 pm

    Try to bound the time:

    while(mediaPlayer.getCurrentPosition() >= Str && mediaPlayer.getCurrentPosition() <= Stop)
    {
    }
    

    However, use this wisely, you might freeze something and end up in ANR.

    You mind find useful using Thread or Handler delaying for 1000ms, but as @dhaag23 mentioned, its unlikely to get exact Stop

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi guys I'm trying to add a css footer but can't it to work
guys I'm trying to correct an application... where I found this lines of code:
guys I'm trying to compile my program in c but I'm getting this error
Hey guys i am trying to automate my system at work for sending artwork
Hi guys I'm trying the code samples from zend frameworks site on how to
hey guys im trying to save a url link in a html form but
Guys, I'm trying to finish up my homework but I'm having some problems here
Hey guys i have been trying to download it from the below link http://www.enterprisedb.com/products-services-training/pgdownload
Hey guys i am trying to install the dropbox-api onto my suse 11.4 but
NOTE: THE PROBLEM IS NOT IN THIS CODE, BUT THE ANSWER FOR EXC_BAD_ACCESS is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.