Welcome!

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

Reply
Highlighted
Developer
Developer
Posts: 42
Registered: ‎04-01-2009
My Device: Not Specified
Accepted Solution

Multiple Image on horizontal line and image button

Trying to make an app for the Storm, I want two images to fill across (fill the width) part of the screen and I was wondering how I can orientate it so I can have two images side by side on the same horizontal line? Right now I am adding the images onto the screen through this code:

 

        Bitmap img1 = Bitmap.getBitmapResource("img/Image1.png");
        BitmapField Image1 = new BitmapField(img1, BitmapField.FIELD_LEFT);
        add(Image1);

 

But when I use

        Bitmap img1 = Bitmap.getBitmapResource("img/Image1.png");
        BitmapField Image1 = new BitmapField(img1, BitmapField.FIELD_RIGHT);
        add(Image1);

 

The image will be on the next horizontal line.

 

Also, how can I make an image into an image button?

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Multiple Image on horizontal line and image button

Try using the FlowFieldManager.

 

Developer
Developer
Posts: 42
Registered: ‎04-01-2009
My Device: Not Specified

Re: Multiple Image on horizontal line and image button

Any example or sample codes on using flowfieldmanager?
Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Multiple Image on horizontal line and image button

You add the FlowFieldManager to your screen and add your bitmap fields to the manager.

 

Or, you can do the same thing with HorizontalFieldManager.

 

Developer
Developer
Posts: 42
Registered: ‎04-01-2009
My Device: Not Specified

Re: Multiple Image on horizontal line and image button

Ok so it looks like it will be something like this:

 

super();

FlowFieldManager field1 = new FlowFieldManager(USE_ALL_WIDTH);

Bitmap img1 = Bitmap.getBitmapResource("img/Image1.png");
BitmapField Image1 = new BitmapField(img1, BitmapField.FOCUSABLE);
field1.add(Image1);

 

Bitmap img2 = Bitmap.getBitmapResource("img/Image1.png");
BitmapField Image2 = new BitmapField(img1, BitmapField.FOCUSABLE);
field1.add(Image2);

 

this.add(field1);

 

Question is how can I mean image1 and image2 as image button?

New Developer
Posts: 20
Registered: ‎09-24-2008
My Device: 9000, 8310, 8520, 9700, 9800, 9500

Re: Multiple Image on horizontal line and image button

Override navigationclick method of BitmapField. It will behave like button
Developer
Posts: 265
Registered: ‎08-27-2009
My Device: Not Specified

Re: Multiple Image on horizontal line and image button

Hi satish and everyone....i have also the same question how to make a image as button i.e when its clicked i want a ObjectchouiceField to drop down i tried to overide the navigation click but couldnt be successfull can u pls provide a piece of code how it done........