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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:37:45+00:00 2026-05-24T13:37:45+00:00

I have multiple SeekBars which the user can manipulate to change various values in

  • 0

I have multiple SeekBars which the user can manipulate to change various values in a text field, I have those values so they will update in real time.

I can’t figure out how to get those numbers (I need to do basic math like add, multiply etc) into a new textview that updates simultaneously.

I’ll try to post some code, but I’m super new to java, android, and even this site so don’t be surprised when none of it makes sense. 😛

jumping down to (what I think) is the important code.

    SeekBar sbc = (SeekBar) findViewById(R.id.seekBar4);
    final TextView tvc = (TextView) findViewById(R.id.textView10);
    sbc.setMax(200);
    sbc.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress,
                boolean fromUser) {
            tvc.setText(String.valueOf(progress-100));
        }

    });

    //set up chance bar and text

    TextView tvp = (TextView) findViewById(R.id.textView14);
    tvp.setText(tvc.getText().toString());

As you can see my seek bar goes from -100 to 100… pretty proud of that one (which took about forever for me to google/research lol)

Also the tvp.setText(tvc.getText().toString()); only pulls out the initial value of tvc

Thanks in advance and in the meantime I’ll keep playing with it.

  • 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-24T13:37:46+00:00Added an answer on May 24, 2026 at 1:37 pm

    I’m not sure why you’re setting tvp and tvc to show the same value, but if you want tvp to update dynamically to match the value of tvc, then you need to move your last bit of code inside your Listener, i.e.:

    @Override
    public void onProgressChanged(SeekBar seekBar, int progress,
            boolean fromUser) {
        tvc.setText(String.valueOf(progress-100));
        TextView tvp = (TextView) findViewById(R.id.textView14);
        tvp.setText(tvc.getText().toString());
    }
    

    Or more cleanly:

    @Override
    public void onProgressChanged(SeekBar seekBar, int progress,
            boolean fromUser) {
        String progress = String.valueOf(progress-100)
        tvc.setText(progress);
        tvp.setText(progress); // move the findViewById outside this method, and put it with tvc
    }
    

    Alternatively, if you’re having difficulty changing the text in tvc, this may be because you’ve declared it as final. If this is the case, try making tvc a non-final member variable of your class, i.e. put it outside any method, at the beginning of your class like this:

    public class MyClass extends Activity {
    
        private TextView tvc;
        ...
    

    EDIT:

    Thanks for the extra info! Try something like this:

    public class MyClass extends Activity {
    
        private TextView tvc;
        private TextView tvd;
        private TextView tvp;
    
        ... // somewhere here you need to get the TextViews from the Layout
        ... // missing out lots of code here and skipping straight to onProgressChanged for first seekBar
    
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress,
                boolean fromUser) {
            String progress1 = String.valueOf(progress-100)
            tvc.setText(progress1);
            String progress2 = tvd.getText().toString;
            String result = resultOfSomeCalculationUsingTheInputs();
            tvp.setText(result);
        }
    }
    

    In your other SeekBar you would do something similar (set the text of tvd, get the text of tvc, perform calculation, set result as text of tvp)

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

Sidebar

Related Questions

We have multiple MFC apps, which use CMutex( false, blah ), where blah allows
I have multiple logos of various companies in various formats that needs to be
I have multiple threads which need to send UDP packets to different IP addresses
I have multiple python processes running in their console output windows. I can set
I have multiple qmake .pro files which are called from a root .pro file
I have multiple TextFiled controls, and can I put a focus on a specific
I have multiple pieCharts in my flex app and when the user clicks a
I have multiple publishers which want to persist their subscription info in storage. Is
I have multiple lines of text in log files in this kind of format:
I have multiple files of text that I need to read and combine into

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.