Using custom search range in Android

I am new to android and need help to use the search range that I found earlier in stackoverflow. The problem is that I cannot get text values ​​in a textview when dragging two thumbs. Desired output image: enter the link here

URL for search range: enter the link here

1 : enter image description here Now I got the min and max value part. The next problem is creating custom values ​​for the slider in the search bar. How I want 10000,20000, .... 50,000, .... 100,000 .... etc. I provide 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);
        }
    });
+4

Source: https://habr.com/ru/post/1528053/


All Articles