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

Trusted Contributor
Posts: 100
Registered: ‎01-13-2012
My Device: Simulator - 9800
My Carrier: Simulator

Setting a Toolbar Over Background Picture

I am trying to implement a toolbar. I am using the code below obtained through this link:



//if (ToolbarManager.isToolbarSupported()) 
            setTitle("Toolbar Demo");                                        // <-----------------
            ToolbarManager manager = new ToolbarManager();

                Bitmap myBitmap = Bitmap.getBitmapResource("icon.png");
                Image myImage = ImageFactory.createImage(myBitmap);
                 * To create more buttons, Repeat the following lines 
                 * up until manager.add() 
                ToolbarButtonField button1 = new ToolbarButtonField(myImage, new StringProvider("butn1"));
                button1.setCommandContext(new Object()
                    public String toString()
                        return "Button1"; 
                button1.setCommand(new Command(new CommandHandler()
                    public void execute(ReadOnlyCommandMetadata metadata, Object context)
                        Dialog.alert("Executing command for " + context.toString());
                manager.add(new ToolbarSpacer(0));
            catch (Exception e)
        // }


I am using the BB Bold simulator 9800 6.0.0 and as a test copy pasting this set of code into the user interface of my simple program. The problem is that the toolbar does not show up at all. The code 

setTitle("Toolbar Demo");

is called and the title is indeed changed but that is all. If I include the if statement to check if the toolbar is supported nothing happens so I think this is where the issue is. However I'd be suprised that the toolbar is actually not supported on a newer bold simulator. That said, I am implementing a background vertical field manager to display a background image - I'm not sure if this would be troublesome to the code. Again I put this code in public UserInterfaceScreen()  which is in final class UserInterfaceScreen extends MainScreen.


Any assistance is appreciated.


All Replies
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Setting a Toolbar Over Background Picture

Can you clarify which simulator you are using? The 9800 actually corresponds to the the Torch, not the Bold. If you are using a 6.0 Bold, it's not expected to work (ToolbarManager.isToolbarSupported() should return false) as it is not a touch device.

Paul Bernhardt
Application Development Consultant

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Trusted Contributor
Posts: 100
Registered: ‎01-13-2012
My Device: Simulator - 9800
My Carrier: Simulator

Re: Setting a Toolbar Over Background Picture

Sorry about the mixup, I am using a Blackberry Bold Simulator; in the Program Folders view I have Research in Motion -> Blackberry Simulator -> 6.0 -> 9800. 


Do you know if the new Bold with the touch interface will be supporting the toolbar?