09-06-2012 03:36 AM
hi
i have created one slider Bar by Referring the URL:https://github.com/blackberry/Samples-for-Java/blo
but i am not getting what code ,i should write to control my voulme,by dragging the slider?can any one help?
09-06-2012 04:08 AM
I use a similar Field and there are just two parts to the requirement:
a) Create a FieldChangeListener and then associate this with the slider using code like:
slider.setChangeListener(< your FieldChangeListener >);
b) In the FieldChanged method, get the new value:
For example:
public void fieldChanged(Field field, int context) {
if ( field == slider ) {
value = slider.getValue();
....
Pretty much the same process is used to be notified of changes in any Field.
09-06-2012 04:17 AM - edited 09-06-2012 04:18 AM
can you please provide me the code to increase or decrease the volume if we drag the slider?
if(field==slider){
slider.getValue();
//what code should i place here
}
09-06-2012 04:29 AM - edited 09-06-2012 04:29 AM
VolumeControl volume = (VolumeControl) player.getControl("VolumeControl");
volume.setLevel(slider.getValue());