0

i have searched a lot but can't find any thing which help me to know How to scroll edit text content on change of seek bar based on the current position and progress.

Please help.....

public void startScrollingText() {

    timer = new Timer();

    System.out.println(CurrentValues.cur_script_speed
            + "its a current speed");
    script_speed = (int) (100 - CurrentValues.cur_script_speed);
    timer.schedule(new TimerTask() {

        @Override
        public void run() {
            MainActivity.this.runOnUiThread(new Runnable() {
                public void run() {
                    final Layout layout = script.getLayout(); // System.out.println(textview.getScrollY());
                    if (layout != null) {
                        int scrollDelta = layout.getLineBottom(script
                                .getLineCount() - 1)
                                - script.getScrollY()
                                - script.getHeight();
                        // System.out.println(scrollDelta);
                        if (scrollDelta > 0)
                            script.scrollTo(0, script.getScrollY() + 5);
                        // else
                        // script.scrollTo(0, 0);
                        System.out.println(CurrentValues.cur_script_speed
                                + " current speed");
                    }
                }
            });

        }

    }, 1000, script_speed + 1);
}
Vijay Laxmi
  • 165
  • 1
  • 21

1 Answers1

0

If you have got SeekBar working and EditText initialized then you must know that the values would change with the method below.

And this is what you should do,

public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
               yourEditText.setText("changing values are "+progress);
            }
Prateek
  • 3,664
  • 5
  • 35
  • 73
  • thanks but i need to scroll edittext content... plese help if you know how to scroll edit text – Vijay Laxmi Feb 23 '13 at 07:32
  • Call the above function inside onprogresschanged as I have shown above http://stackoverflow.com/a/6124165/1503130 this might solve your problem. But all you need to do inside the above function. – Prateek Feb 23 '13 at 07:56