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
Forums Advisor I
vaishali28
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Problem in scree transition

Hi

I have cretaed an app, that contains a background image and another image on it. If i focus on the foreground image another screen opens that also contains the background image and the same foreground image.Again the same procedure goes on.

Here is the snapshot of the image1.png2.png

I have done this through screen transition. I have created 3 screens that contain the background Image and foreground image. I want when i slide the first foreground image only the background image changes and the foreground will remain same.means i dont have to give it on the all screen.

So,how to do this?

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem in screen transition

I'm not sure of the best way to do this, but here is something to try.

 

Basically you will take an ordinary HorizontalFieldManager, and add your backgrounds to this, by adding several background Images.  So when you display this HFM, you can scroll this and see each background image in turn.  Work on this until you have this displaying the backgrounds as you want.  Make the BirmapField's FOCUSABLE as that should look after the scrolling for you. 

 

Now create a special attribute - a Bitmap - for the HFM.  Add a special method to set this Bitmap - say called setForegroundImage(). Once you have sorted out how to do that, then override the paint() method for this manager, and in your overridden method, caller super.paint() which will paint your background image, then use drawBitmap to paint the special Bitmap.  To make sure you are painting this in the correct place, you will need to base the position of the Bitmap on the horizontalScroll position of the HFM. 

 

Give this a try, and see if does something like what you want.

 

Create this initially independently of you real application, so that you cut/paste the code here.  It should not be a large amount of code.

 

Good luck

Please use plain text.
Forums Advisor I
vaishali28
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Problem in screen transition

Thanks Peter Sir for your reply.

But how can i add multiple background images to the HorizontalFieldManager??

Please use plain text.
Forums Advisor I
vaishali28
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Problem in screen transition

i have added all the background images to the horizontal field manager as:

 

BitmapField Image1 = new BitmapField(b1, BitmapField.FOCUSABLE);
manager1.add(Image1);


BitmapField Image2 = new BitmapField(b2, BitmapField.FOCUSABLE);
manager1.add(Image2);

BitmapField Image3 = new BitmapField(b3,BitmapField.FOCUSABLE);
manager1.add(Image3);

BitmapField Image4= new BitmapField(b4,BitmapField.FOCUSABLE);
manager1.add(Image4);

 

Now how to add the foregroung image to the manager?

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem in screen transition

Please read the instructions in my previous post carefully.  If you need clarification on the instructions please specify what that is.

Please use plain text.
Forums Advisor I
vaishali28
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Problem in screen transition

Ok

So firstly i want to know , how can i add multiple background images to the horizontalfieldmanager?

 

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem in screen transition

This is what the first paragraph of my post says.

 

"Basically you will take an ordinary HorizontalFieldManager, and add your backgrounds to this, by adding several background Images.  So when you display this HFM, you can scroll this and see each background image in turn.  Work on this until you have this displaying the backgrounds as you want.  Make the BirmapField's FOCUSABLE as that should look after the scrolling for you. "

 

The comment is "Work on this until you have this displaying the backgrounds as you want".

 

Have you reached that stage?

Please use plain text.
Developer
svmrajesh
Posts: 164
Registered: ‎07-23-2013
My Device: Blackberry z10
My Carrier: Airtel

Re: Problem in screen transition

where you need to fetch multple bg images

___________________________________________________________________________________________

*************Plese *********LIKE**** & ****ACCEPT as Solution*** If you got suggestion for your Query.

@RAJESH SVM ----- Blackberry Mobile App Developer, Blaze, India.
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem in screen transition

I have just realized my post was not as clear as it could have been.

 

Let me restate in a way that I think is clearer.

 

Take an ordinary HorizontalFieldManager, and add your backgrounds to this, by adding several background Images each as a separate BitmapField.  So when you display this HFM, you can scroll this and see each background image (BitmapField) in turn.  Work on this until you have this displaying the backgrounds (BitmapFields) as you want.  Make the BirmapFields FOCUSABLE as that should look after the scrolling for you.

 

I hope this is clearer.

Please use plain text.
Forums Advisor I
vaishali28
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Problem in screen transition

I have added images to the HFM and i am getting the horizontally scrolling images. Now the problem lies in placing the foreground image.

public UiAppScreen()
    {
        
        super(Manager.HORIZONTAL_SCROLL);
        
        manager1 = new HorizontalFieldManager();
        resize1 = resizeImage(background1, Display.getWidth(), Display.getHeight());
        field1 = new BitmapField(resize1,BitmapField.FOCUSABLE);
        manager1.add(field1);
        
        resize2 = resizeImage(background1, Display.getWidth(), Display.getHeight());
        field2 = new BitmapField(resize2,BitmapField.FOCUSABLE);
        manager1.add(field2);
        
        resize3 = resizeImage(background1, Display.getWidth(), Display.getHeight());
        field3 = new BitmapField(resize3,BitmapField.FOCUSABLE);
        manager1.add(field3);
        
        resize4 = resizeImage(background1, Display.getWidth(), Display.getHeight());
        field4 = new BitmapField(resize4,BitmapField.FOCUSABLE);
        manager1.add(field4);
        
        add(manager1);
    }

Please use plain text.