Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

SeekBarEvents

WonderCsabo edited this page Nov 10, 2014 · 13 revisions

Since AndroidAnnotations 2.7

You can bind methods to handle specific events from SeekBar view.

@SeekBarProgressChange

This annotation is intended to be used on methods to receive events defined by SeekBar.OnSeekBarChangeListener.onProgressChanged(SeekBar, int, boolean) when the progress level of a SeekBar view has changed.

The annotation value should be one or several R.id.* fields that refers to an android.widget.SeekBar. If not set, the method name will be used as the R.id.* field name.

The method may have multiple parameter :

  • A android.widget.SeekBar parameter to determine which view has targeted this event
  • An int parameter named progress to get the progress level of the SeekBar
  • A boolean parameter named fromUser to determine if this event is triggered by the user

All of those parameters are parameter are optional.

Some usage examples of @SeekBarProgressChange annotation:

 @SeekBarProgressChange(R.id.seekBar)
 void onProgressChangeOnSeekBar(SeekBar seekBar, int progress, boolean fromUser) {
 	// Something Here
 }
 
 @SeekBarProgressChange(R.id.seekBar)
 void onProgressChangeOnSeekBar(SeekBar seekBar, int progress) {
 	// Something Here
 }
 
 @SeekBarProgressChange({R.id.seekBar1, R.id.seekBar2})
 void onProgressChangeOnSeekBar(SeekBar seekBar) {
 	// Something Here
 }

 @SeekBarProgressChange({R.id.seekBar1, R.id.seekBar2})
 void onProgressChangeOnSeekBar() {
 	// Something Here
 }

@SeekBarTouchStart and @SeekBarTouchStop

Those annotations are intended to be used on methods to receive events defined by SeekBar.OnSeekBarChangeListener.onStartTrackingTouch(SeekBar seekBar) and SeekBar.OnSeekBarChangeListener.onStopTrackingTouch(SeekBar seekBar) when the user has started or finished to move the cursor of the targeted SeekBar.

The annotation value should be one or several R.id.* fields that refers to an android.widget.SeekBar. If not set, the method name will be used as the R.id.* field name.

The method can have zero or one parameter of type SeekBar.

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Extending AndroidAnnotations

Clone this wiki locally