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
Contributor
Posts: 31
Registered: ‎02-09-2010
My Device: Storm
My Carrier: telus

opening a new screen

As the people that have helped me in the past know, I am very new to this as well I am trying to learn at 5:00 am,

The problem is probably simple

I have 4 buttons on my main screen and i want to open a new screen with each button

I,m not sure what I am doing wrong or if I am even close

can someone take a look

Thanks

 

Main Screen :

 

 

CouponScreen couponScreen = new CouponScreen();

UiApplication(UiApplication.getApplication()).pushScreen(couponScreen);

couponButton.setChangeListener(this);

     

}

 

public void fieldChanged(Field arg0, int arg1) {

      ButtonField field = null;

      if (field == couponButton){

            coupon();

      }    

}

 

private void coupon() {

      // TODO Auto-generated method stub 

}

 

private UiApplication UiApplication(Application application) {

      // TODO Auto-generated method stub

      return null;

}}

 

 

Coupon Screen :

 

package com.ProductFinder;

 

import net.rim.device.api.ui.UiApplication;

import net.rim.device.api.ui.component.LabelField;

import net.rim.device.api.ui.container.MainScreen;

 

public class CouponScreen extends MainScreen {

      public CouponScreen(){

      add(new LabelField("eCOUPONS"));

      {

}}

 

}

     

 Cheers !!

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: opening a new screen

go to the samples folder of your jde / ejde. open one of the samples. copy the code and adjust it to your needs.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Posts: 31
Registered: ‎02-09-2010
My Device: Storm
My Carrier: telus

Re: opening a new screen

Thanks for the response but I am still Having a hard time getting from my main Screen to my next screen (CouponScreen) here is a look at the buttons on the main screen I want to use the couponbutton

 

findButton = new ButtonField("FIND a BRAND", ButtonField.CONSUME_CLICK);

          couponButton = new ButtonField("  eCOUPONS  ", ButtonField.CONSUME_CLICK);

          storeButton = new ButtonField("FIND a STORE", ButtonField.CONSUME_CLICK);

          labelButton = new ButtonField(" SEE a LABEL", ButtonField.CONSUME_CLICK);

          HorizontalFieldManager buttonManager = new HorizontalFieldManager(Field.FIELD_HCENTER);

          buttonManager.add(couponButton);

          buttonManager.add(findButton);

          add(buttonManager);

         

          add(new SeparatorField());

          HorizontalFieldManager buttonManager1 = new HorizontalFieldManager(Field.FIELD_HCENTER);

          buttonManager1.add(labelButton);

          buttonManager1.add(storeButton);

          add(buttonManager1);

         

          add(new SeparatorField());

 

Cheers

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: opening a new screen

implement fieldchangelistener, either in your screen or for each button.

in your fieldchanged method you can push the new screen.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Contributor
Posts: 7
Registered: ‎02-15-2010
My Device: Not Specified

Re: opening a new screen

Hi..

As suggested, you need to implement the FieldChangeListener and in its fieldchanged method, you need to push the new screen. Say You need to push one more mainscreen

 

MainScreen ms=new MainScreen();

LabelField title=new LabelField("Next Screen");

ms.setTitle(title);


synchronized(UiApplication.getEventLock()){

           UiApplication.getUiApplication().pushScreen(ms);

}

 You can use the above code.. This must work.. raju.