Issue while using moving effect on slider

Kirti

Here i use a value changing effect on a slider; if i move the slider, it will scroll and display updated values in an edit field, as per the moving of the slider bar. Also, there is an edit field effect where the slider should be moved as per the values entered into the edit field; but it is not working.

When i comment out part of the edit field effect, it is working properly but when i apply that edit field effect again, then it is not working ...

// for slider move

    FieldChangeListener listenerslider1 = new FieldChangeListener() {

        public void fieldChanged(Field field, int context) {
            try {

                if (field == serumosmslider) {

                    int serumosmslidervalue = serumosmslider.getValue();
                    String strplasmaslidervalue = Integer
                            .toString(serumosmslidervalue);
                    edtserumosm.setText(strplasmaslidervalue);

                }

            } catch (IllegalStateException e) {

                e.printStackTrace();
            } catch (NullPointerException e) {
                e.printStackTrace();
            }
        }
    };

    serumosmslider.setChangeListener(listenerslider1);

// for editfield

    FieldChangeListener listenereditslider1 = new FieldChangeListener() {

        public void fieldChanged(Field field, int context) {

            hfmslider1.deleteAll();
            String stredtweight = edtserumosm.getText().toString();

            int editweight = Integer.parseInt(stredtweight);

                SliderField theSlider = new SliderField(slider2thumb,
                        slider2progress, slider2base, slider2thumbfoc,
                        slider2progressfoc, slider2basefoc, 201,
                        editweight, 10, 10);
                hfmslider1.add(theSlider);
                hfmslider1.invalidate();


        }

    };

    edtserumosm.setChangeListener(listenereditslider1);
Nate

You appear to be recreating your SliderField every time the EditField's value changes.

    SliderField theSlider = new SliderField(slider2thumb,
           slider2progress, slider2base, slider2thumbfoc,
           slider2progressfoc, slider2basefoc, 201,
           editweight, 10, 10);
    hfmslider1.add(theSlider);

I don't think you want to do that. Just like you update the EditField text when the slider field changes, I think you should update the SliderField value when the EditField text is changed. So, something like this:

FieldChangeListener listenereditslider1 = new FieldChangeListener() {

    public void fieldChanged(Field field, int context) {

        if (field == edtserumosm && context != FieldChangeListener.PROGRAMMATIC) {

            String stredtweight = edtserumosm.getText().toString();

            try {
                int editweight = Integer.parseInt(stredtweight);
                serumosmslider.setValue(editweight);
            } catch (NumberFormatException nfe) {
                // TODO: anything?
            }
        }
    }

};

edtserumosm.setChangeListener(listenereditslider1);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to run a fadein effect halfway while a div is animating?(moving up)

Issue while trying to display images from display on carousel slider

Flutter Slider Not Moving or Updating

Issue while moving to a view Controller in IOS

Blur effect using slider Is not working properly

Add and remove grayscale effect to Image using flickity slider

Mouse click on WPF (Time)Slider has no effect when slider thumb is moving bound to a timer

get value of slider with (change) of particular slider while using multiple sliders

Loader appears while using the slider revolution

Issue with moving rigidbody using mouse in Unity

Moving slider with Cypress

Get offset of element while moving using animation

Issue while creating image slider using jquery

Moving a slider to change resolution

Parallax effect issue using JavaScript

Slider is moving while playing the video

Jquery toggle issue using jquery ui effect

white space/gap issue while sliding in custom content slider

two jquery sliders having same class name but the issue is on moving the slider

Get value from jQuery slider while it's moving

Moving UIButton on Y axis while using Autolayout

how to apply brightness ,contrast ,gamma on image while moving slider in iOS?

How to remove sliding effect while moving one state to another in ionic?

Issue while using viewDidLayoutSubviews

jump effect while moving rotated rectangle

Issue On Adding Magnify Effect to Dynamically Moving Element

Get the cursor position while moving it using MouseAdapter

Facing an issue while performing 5 year and 10 year moving average?

flutter Slider Widget Issue: Thumb Not Moving or onChanged Event Not Triggering

TOP Ranking

HotTag

Archive