if (ToolbarManager.isToolbarSupported()) { setTitle("Toolbar Demo"); ToolbarManager manager = new ToolbarManager(); setToolbar(manager); try { Bitmap myBitmap = Bitmap.getBitmapResource("myImg.jpg"); 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)); manager.add(button1); } catch (Exception e) { System.out.println(e.getMessage()); } } else { Dialog.alert("The Toolbar is not supported on this device."); }
Thursday, June 27, 2013
Toolbar in Blackberry
Use a toolbar to provide users with a quick and easy way to access frequent
actions for an application or screen. Each toolbar consists of a set of icons
that appears along the bottom of the screen.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment