Search code examples
user-interfaceblackberryjava-meblackberry-jde

how to add the bitmap as the background to the blackberry screen


i want to add the white background screen to my blackberry screen (i.e.,main screen) after addind that i am able to draw something on to the screen. how to create the background and how to draw on that screen. please suggest me. please send me the sample code... i have written this code but it is not working...

Background bg = 
BackgroundFactory.createBitmapBackground(
    Bitmap.getBitmapResource("/Background.png"));
setBackground(bg);
VerticalFieldManager verticalFieldManager = new VerticalFieldManager();


 add(verticalFieldManager);

Solution

  • Try this..

    final Bitmap backgroundBitmap = Bitmap.getBitmapResource("blackbg.png");
    
    VerticalFieldManager mainManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR )
    { 
    public void paint(Graphics graphics)
    {
    graphics.clear();
    graphics.drawBitmap(0, 0, deviceWidth, deviceHeight, backgroundBitmap, 0, 0); 
    super.paint(graphics);
    } 
    };