Skip to content
matboniface edited this page Aug 18, 2012 · 12 revisions

Since AndroidAnnotations 2.7

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

@ProgressChange

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 @ProgressChange annotation:

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

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

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Clone this wiki locally