List of all Iphone and Blackberry Development codes in a one click Iphone,objective C,xcode,blackberry Development,iOS Development
Showing posts with label ToolBar. Show all posts
Showing posts with label ToolBar. Show all posts

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.
            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.");
            }

Monday, April 16, 2012

Display ToolBar with auto closing feature in Blackberry








EncodedImage e1 = EncodedImage.getEncodedImageResource("home.png");
EncodedImage e2 = EncodedImage.getEncodedImageResource("map.png");
EncodedImage e3 = EncodedImage.getEncodedImageResource("members.png");
EncodedImage e4 = EncodedImage.getEncodedImageResource("message.png");
EncodedImage e5 = EncodedImage.getEncodedImageResource("settings.png");
EncodedImage e6 = EncodedImage.getEncodedImageResource("logout.png");


EyelidFieldManager manager = new EyelidFieldManager();
HorizontalFieldManager buttonPanel = new HorizontalFieldManager(Field.FIELD_TOP | Field.USE_ALL_WIDTH);
VerticalFieldManager vfm=new VerticalFieldManager();
vfm.add(new LabelField("Map"));
vfm.add(new BitmapField(e2.getBitmap(),FOCUSABLE){
  protected boolean navigationClick(int status, int time){
      
     Dialog.alert("MAP");
     return true;
    }
});
buttonPanel.add(vfm);
buttonPanel.add(new LabelField("  "));
VerticalFieldManager vfm1=new VerticalFieldManager();
vfm1.add(new LabelField("Members"));
vfm1.add(new BitmapField(e3.getBitmap(),FOCUSABLE){
  protected boolean navigationClick(int status, int time){
      
     Dialog.alert("Members");
     return true;
    }
});
buttonPanel.add(vfm1);
VerticalFieldManager vfm2=new VerticalFieldManager();
vfm2.add(new LabelField("Message"));
vfm2.add(new BitmapField(e4.getBitmap(),FOCUSABLE){
  protected boolean navigationClick(int status, int time){
      
     Dialog.alert("Message");
     return true;
    }
});
buttonPanel.add(vfm2);
VerticalFieldManager vfm3=new VerticalFieldManager();
vfm3.add(new LabelField("Settings"));
vfm3.add(new BitmapField(e5.getBitmap(),FOCUSABLE){
  protected boolean navigationClick(int status, int time){
      
     Dialog.alert("Settings");
     return true;
    }
});
buttonPanel.add(vfm3);
VerticalFieldManager vfm4=new VerticalFieldManager();
vfm4.add(new LabelField("Logout"));
vfm4.add(new BitmapField(e6.getBitmap(),FOCUSABLE){
  protected boolean navigationClick(int status, int time){
      
     Dialog.alert("Logout");
     return true;
    }
});
buttonPanel.add(vfm4);
manager.setEyelidDisplayTime(5000);
manager.add(buttonPanel);
add(manager);