4

I am new to android and need help to use the range seekbar that I found earlier on stackoverflow. The problem is I am not able to get the text values in a textview on dragging the two thumbs. The desired output image is :enter link description here

The url for range-seekbar is : enter link description here

1: enter image description here Now I have done the getting the min and max value part. The next problem is having custom values for the slider in seekbar. Like i want 10000,20000,....50000,....100000.... etc. I am providing the code for my main class.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // create RangeSeekBar as Integer range between 20 and 75
    RangeSeekBar<Integer> seekBar = new RangeSeekBar<Integer>(0, 100000,
            getApplicationContext());
    seekBar.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Integer>() {
        @Override
        public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar,
                Integer minValue, Integer maxValue) {
            // handle changed range values
            Log.i("TAG", "User selected new range values: MIN=" + minValue
                    + ", MAX=" + maxValue);
        }
    });

    final TextView tv = new TextView(this);
    tv.setText("Val");

    ll = (LinearLayout) findViewById(R.id.ll1);
    ll.addView(seekBar);
    ll.addView(tv);

    seekBar.setNotifyWhileDragging(true);

    seekBar.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Integer>() {

        @Override
        public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar,
                Integer minValue, Integer maxValue) {
            // TODO Auto-generated method stub
            tv.setText("Max:Min"+"\n"+minValue+" : "+maxValue);
        }
    });
Ahmad Aghazadeh
  • 16,571
  • 12
  • 101
  • 98
abl online
  • 43
  • 1
  • 6

0 Answers0