AndroidWheel icon indicating copy to clipboard operation
AndroidWheel copied to clipboard

SetValue causes a "divide by 0" exception.

Open jamrader opened this issue 9 years ago • 0 comments

Using the setvalue method gives me a divide by zero exception.

My code is as follows:

            mWheel = (Wheel) v.findViewById(R.id.wheel);
            mWheel.setOnScrollListener( new Wheel.OnScrollListener() {

                @Override
                public void onScrollStarted( Wheel view, float value, int roundValue ) {
                    Log.i("SPINZ", "STARTED: f: " + value + " / i: " + roundValue);
                }

                @Override
                public void onScrollFinished( Wheel view, float value, int roundValue ) {
                    Log.i("SPINZ", "FINISHED: f: " + value + " / i: " + roundValue);
                    roundValue *= -1;
                    roundValue += 40;
                    if (roundValue >= 0 && roundValue < sections.length)
                        mSectionTV.setText(sections[roundValue]);
                }

                @Override
                public void onScroll( Wheel view, float value, int roundValue ) {

                    roundValue *= -1;
                    roundValue += 40;
                    if (roundValue >= 0 && roundValue < sections.length)
                        mSectionTV.setText(sections[roundValue]);
                }
            } );

            mWheel.setValue(1.0f, true);

If I take mWheel.setValue(1.0f, true) and move it to right after mWheel = (Wheel) v.findViewById(R.id.wheel), then I don't get the divide by zero exception, but the method doesn't do anything either.

jamrader avatar Mar 17 '16 21:03 jamrader