Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
Posts: 63
Registered: ‎08-30-2012
My Device: 9900
My Carrier: Various

How to Create Play/ Pause Button and Volume Control Seek Bar on BlackBerry Screen?

Hi

    i have a requirement to create  Play/ Pause  Button and Volume Control Seek Bar on BlackBerry (java)Screen while playing  Radio?can any one what is the code i need write?

Developer
Posts: 107
Registered: ‎05-26-2011
My Device: Torch
My Carrier: Mobilink

Re: How to Create Play/ Pause Button and Volume Control Seek Bar on BlackBerry Screen?

Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: How to Create Play/ Pause Button and Volume Control Seek Bar on BlackBerry Screen?

You can check below project

 

https://github.com/blackberry/Samples-for-Java/tree/master/Advanced%20UI

 

There are all advance Ui component are available so you got solution.

 

Thanks.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to Create Play/ Pause Button and Volume Control Seek Bar on BlackBerry Screen?

Regular Contributor
Posts: 63
Registered: ‎08-30-2012
My Device: 9900
My Carrier: Various

Re: How to Create Play/ Pause Button and Volume Control Seek Bar on BlackBerry Screen?

[ Edited ]

hii,

     thanks for reply,initially i have created the slide bar on my screen,successfully i am able to display it,but how to reduce the lenth of the slide bar,so that i want to place my play/pause button beside the slide bar in a single line,how to place the above slide bar in the botoom of the screen,instead of top of the screen

 

_startPlayingButton = new ButtonField("Play", ButtonField.CONSUME_CLICK);

            setTitle( "Slider Example" );
            
            SliderField slider;
            
          slider = new SliderField(
                Bitmap.getBitmapResource( "slider2_thumb_normal.png" ), Bitmap.getBitmapResource( "slider2_progress_normal.png" ), Bitmap.getBitmapResource( "slider2_base_normal.png" ),
                Bitmap.getBitmapResource( "slider2_thumb_focused.png" ), Bitmap.getBitmapResource( "slider2_progress_focused.png" ), Bitmap.getBitmapResource( "slider2_base_focused.png"),
                20, 0, 16, 16, FOCUSABLE );
            slider.setPadding( 20, 20, 20, 20 );
            add( slider );
            add(_startPlayingButton);

 

if i do like this,i am able to place the slider on one line and then in the next line,i am able to place the button,i want to place both on a single line,at the bottom of the screen?

Regular Contributor
Posts: 63
Registered: ‎08-30-2012
My Device: 9900
My Carrier: Various

Re: How to Create Play/ Pause Button and Volume Control Seek Bar on BlackBerry Screen?

i have created the playe instance using

_player = Manager.createPlayer(_source);

 

on the slide bar if,i drag on it ,i should be able to increase or decrease the volume,what is the code i need to write?

Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: How to Create Play/ Pause Button and Volume Control Seek Bar on BlackBerry Screen?

You can set the volume like this 

 VolumeControl volume = (VolumeControl) _player.getControl("VolumeControl");
    volume.setLevel(30);

 Note :- You use the Advance Ui or SeekBar at that time you got the postion.So set the postion of SeekBar  into SetLevel.

 

Thanks.

 

Regular Contributor
Posts: 63
Registered: ‎08-30-2012
My Device: 9900
My Carrier: Various

Re: How to Create Play/ Pause Button and Volume Control Seek Bar on BlackBerry Screen?

hii,

     thanks for reply,initially i have created the slide bar on my screen,successfully i am able to display it,but how to reduce the lenth of the slide bar,so that i want to place my play/pause button beside the slide bar in a single line,how to place the above slide bar in the botoom of the screen,instead of top of the screen

 

_startPlayingButton = new ButtonField("Play", ButtonField.CONSUME_CLICK);

            setTitle( "Slider Example" );
            
            SliderField slider;
            
          slider = new SliderField(
                Bitmap.getBitmapResource( "slider2_thumb_normal.png" ), Bitmap.getBitmapResource( "slider2_progress_normal.png" ), Bitmap.getBitmapResource( "slider2_base_normal.png" ),
                Bitmap.getBitmapResource( "slider2_thumb_focused.png" ), Bitmap.getBitmapResource( "slider2_progress_focused.png" ), Bitmap.getBitmapResource( "slider2_base_focused.png"),
                20, 0, 16, 16, FOCUSABLE );
            slider.setPadding( 20, 20, 20, 20 );
            add( slider );
            add(_startPlayingButton);

 

if i do like this,i am able to place the slider on one line and then in the next line,i am able to place the button,i want to place both on a single line,at the bottom of the screen

Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: How to Create Play/ Pause Button and Volume Control Seek Bar on BlackBerry Screen?

Hello,

 

   Please Check out below example.

 

HorizontalFieldManager hfmSecond = new HorizontalFieldManager();
LabelField lblCurrentTime = new LabelField("0:0", FIELD_VCENTER);
hfmSecond.add(hfmTime);
SliderField	seekBar = new SliderField(slider_Thumb_Images, slider_Back_Images,
				slider_Focus_Images, 50, 0, 10, 10);
seekBar.setPadding(5, 5, 5, 35);
hfmSecond.add(seekBar);
add(hfmSecond);

 Thanks.

 

 

==========================================================================

 

Would like then feel free provide Kudo

Regular Contributor
Posts: 63
Registered: ‎08-30-2012
My Device: 9900
My Carrier: Various

Re: How to Create Play/ Pause Button and Volume Control Seek Bar on BlackBerry Screen?

hi

 

how to handle two actions,with a single button ,i.e play/pause button?