Sunday 4 November 2012

Blackberry SliderBar(SeekBar) Creation

This article will hepls you to Create a SliderBar on BlackBerry Screen,You can use the SliderBar for Controlling a Volume etc...According to your Actual Requirement

To Build this Application you require the below Classes
1)SliderApp: This is the Main Class.The Program Execution will Starts from here.

import net.rim.device.api.ui.UiApplication;

public class SliderApp extends UiApplication {
private static SliderApp app;
private SliderScreen screen;
public SliderApp(){
screen=new SliderScreen();
pushScreen(screen);
}
public static void main(String args[]){
app=new SliderApp();
app.enterEventDispatcher();
}
}



2)SliderScreen:You can get the Complete Code of this class below.
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;

public class SliderScreen extends MainScreen  {
 private SliderField slider;
 private  HorizontalFieldManager manager;
 public SliderScreen(){
            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"), 8, 4,
8, 8, FOCUSABLE);
manager = new HorizontalFieldManager();
manager.add(slider);
setStatus(manager);
      }

      }
3)SliderField: You can get the Complete Code Click Here
Copy and Paste the Code.


Note: You can Download the Slider Images Click Here .

Check the Package Structure and Output in  below ScreenShots:

Package Structure:




OutPut:





No comments:

Post a Comment