Ahmad Shahwaiz
Ahmad Shahwaiz

Reputation: 1492

Blackberry background image?

I have searched but haven't find out any solution, i have but its creating problems. when I insert this it says illegal argument and doesn't start.

Bitmap bitmap = Bitmap.getBitmapResource("Background.png");

 this.getMainManager().setBackground(

             BackgroundFactory.createBitmapBackground(bitmap)
         );

It doesn't work.

Thanks for helping! Its working. Just a typo error of my path

Upvotes: 0

Views: 83

Answers (1)

Rince Thomas
Rince Thomas

Reputation: 4158

tyy this -

final Bitmap top = Bitmap.getBitmapResource("your background image.png");
final VerticalFieldManager top_ = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR | Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH){

        public void paint(Graphics graphics) {
            graphics.drawBitmap(0, 0, top.getWidth(),
                    top.getHeight(), top, 0, 0);
            super.paint(graphics);
        }

    };

Now you add all your fields to this top_. then add the top_ to your screen. If there is no fields, it will not display the background image. so Dont forget to add some fields.

Upvotes: 1

Related Questions