Android : can't get progress from seekbar

on Saturday, September 6, 2014


I want to obtain the current position of a seekbar. For this I use setOnSeekBarChangeListener( ), but onProgressChanged( ) is never called.


I already use a seekbar and there the setOnSeekBarChangeListener( ) method works correctly. The only difference: I use a dialog in this case.


So I want to obtain the current position from that Seekbar:



SeekBar android:id="@+id/pivotXSeekbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:max="100" android:minWidth="50dp"



And there I set the setOnSeekBarChangeListener( ):



final LayoutInflater layoutinflater = (LayoutInflater) this .getSystemService(LAYOUT_INFLATER_SERVICE); final View animationseinstellungenView = layoutinflater.inflate( R.layout.animationseinstellungen, null); FrameLayout layout = (FrameLayout) findViewById(R.id.hauptanimationsLayout); SeekBar fromxScaleWertSeekbar = (SeekBar) animationseinstellungenView .findViewById(R.id.fromXScaleSeekbar); SeekBar pivotXSeekBar = (SeekBar) animationseinstellungenView .findViewById(R.id.pivotXSeekbar); // fromxScaleWertSeekbar.incrementProgressBy(1);




pivotXSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub

}

@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub

}

@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
TextView pivotXMinText = (TextView) animationseinstellungenView
.findViewById(R.id.pivotXMinText);
Log.d("progress", "progress " + progress);
pivotXMinText.setText("" + progress);

}
});


Where's the problem?


0 comments:

Post a Comment