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 3980576
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:18:26+00:00 2026-05-20T05:18:26+00:00

In my application I must update a seek bar. As I understand, if I’m

  • 0

In my application I must update a seek bar. As I understand, if I’m using the handler I don’t need to use another thread. The problem is that the handleMessage method gets called only once. Here is my sample code.

private Handler mHandler = new Handler() {
    @Override
    public void handleMessage(Message msg) {
        int pos;
        pos = setProgress();
        
        if (mVideoView.isPlaying()) {
            System.out.println("__handleMessage__isPlaying");
            Message msg1 = obtainMessage(REPORT_MSG);
            sendMessageDelayed(msg1, 1000 - (pos % 1000));
        }
    }
};

private int setProgress() {
    SeekBar mProgress = (SeekBar) findViewById(R.id.progress);
    if (mVideoView == null) {
        return 0;
    }
    
    int position = mVideoView.getCurrentPosition();
    int duration = mVideoView.getDuration();
    
    if (mProgress != null) {
        if (duration > 0) {
            // use long to avoid overflow
            long pos = 1000L * position / duration;
            mProgress.setProgress( (int) pos);
        }
        int percent = mVideoView.getBufferPercentage();
        mProgress.setSecondaryProgress(percent * 10);
    }

    return position;
}
  • 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-20T05:18:27+00:00Added an answer on May 20, 2026 at 5:18 am

    As I understand, if I’m using the handler I don’t need to use another thread.

    This is not correct a handler is used to update GUI from an non GUI thread

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

Sidebar

Related Questions

I'm using sass in a php-based application and am trying to use the --update
I have a 32-bit application that must run on a Windows x64 server using
I am developing a WPF application that must run using Windows Classic theme. The
I need to update (well, rewrite really) a SMALL VB6 application which uses ADO
I have gwt web project, which must use application.properties (on client side) loaded as
Periodically my application must update the database. This update may not be automatic. When
I know that I must call Synchronize to update the vcl from a thread
I'm currently creating an application using Play!, and i wanted to update my view
I have an application called Update.jar that I'm trying to use with the java
I am writing an application that must update parts of an already existing xml

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.