Search This Blog

Friday, 18 May 2012

How to use ToolbarManager in Blackberry

Hello friends ,
                Here it is the major thing to give ur app a gorgeous look as you may seen in many apps , a Toolbar or some people call it "Tab Bar".Follow below code to implement that ,

Code:

Initialization :

ToolbarManager _manager = new ToolbarManager();

Now, create an image of  icons to display on this ToolbarManager , as below :

Bitmap _iconB = Bitmap.getBitmapResource("icon.png");
Image _iconI = ImageFactory.createImage(_iconB);

Now,initialize the ToolbarButtonField for this ToolbarManager,as Below:

ToolbarButtonField _but1 = new ToolbarButtonField(_iconI,new StringProvider("Home"));

Now , simple add this ToolbarButtonField to ToolbarManager,as Below:

_manager.add(_but1);

Now, add this ToolbarManager to your screen , as Below:

this.add(_manager);

NOTE:
Remeber you can resize the icons and ToolbarManager as a desscribed in previous posts,Resize ToolbarManager as a manager,use sublayout instead using layout, layout is used for fields not for managers.

No comments:

Post a Comment