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
Super Contributor
Posts: 308
Registered: ‎05-31-2011
My Device: Blackberry-SDK-9800
My Carrier: SimPakage 6.0.0.337_9800 asia.exe
Accepted Solution

proplem to jump from one screen to another

hello experts,

  since one months i am on blackberry,  but still i am getting lots of problem...

  actually the blackberry project is not visible in the simulator, if  i write the code to jump from one screen to another

 

 

Highlighted
Developer
Posts: 404
Registered: ‎05-31-2011
My Device: curve
My Carrier: devel

Re: proplem to jump from one screen to another

can you post your code?
Super Contributor
Posts: 278
Registered: ‎11-04-2010
My Device: 4.5 and above
My Carrier: none

Re: proplem to jump from one screen to another

Hi yogesh,

   First of all, we should all all the fields to the class extending mainscreen like this

 

public class mainscreen extends MainScreen implements FieldChangeListener{

     private ButtonField button;

     mainscreen(){

         LabelField label = new LabelField("This is the first screen");

         add(label);

          button = new ButtonField("click",CONSUME_CLICK}

         button.setChangeListener(this);

         add(button);

     }

   public void fieldChanged(Field field, int context){
        if(field == button){

                UiApplication.getUiApplication().pushScreen(new nextScreen());

         }

}

FieldChangeListener is an interface to listen user click events.

 

This is another class

 

 

public class nextScreen extends MainScreen {

     nextScreen(){

         LabelField label = new LabelField("This is the second screen");

         add(label);

     }

}

 

 

 

Thanks & Regards

             pp

Super Contributor
Posts: 308
Registered: ‎05-31-2011
My Device: Blackberry-SDK-9800
My Carrier: SimPakage 6.0.0.337_9800 asia.exe

Re: proplem to jump from one screen to another

final class HelloWorldScreen extends MainScreen implements FieldChangeListener { ObjectChoiceField choice=null; public HelloWorldScreen() { super(); String choicestrs[] = {"Opt 1", "Opt 2", "Opt 3"}; choice = new ObjectChoiceField("Object Choice Field: ", choicestrs, 0); choice.setChangeListener(this); add(choice); } public void openAnotherForm(){ AnotherForm newScreen = new AnotherForm(); UiApplication.getUiApplication().pushScreen(newScreen); } public void fieldChanged(Field arg0, int arg1) { openAnotherForm(); } } class AnotherForm extends MainScreen { public AnotherForm() { super(); add(new LabelField("Another Form")); } }
Super Contributor
Posts: 308
Registered: ‎05-31-2011
My Device: Blackberry-SDK-9800
My Carrier: SimPakage 6.0.0.337_9800 asia.exe

Re: proplem to jump from one screen to another

sorry its in wrong format,

   do i need to install anything to enable push() tecnology

my code is

final class HelloWorldScreen extends MainScreen implements FieldChangeListener

{       

ObjectChoiceField choice=null;       

public HelloWorldScreen()   

    {               

super();               

String choicestrs[] = {"Opt 1", "Opt 2", "Opt 3"};             

  choice = new ObjectChoiceField("Object Choice Field: ", choicestrs, 0);           

    choice.setChangeListener(this);         

  add(choice);   

}   

public void openAnotherForm()

{       

AnotherForm newScreen = new AnotherForm();       

UiApplication.getUiApplication().pushScreen(newScreen);   

}   

public void fieldChanged(Field arg0, int arg1)

{     

  openAnotherForm();
    }

}

class AnotherForm extends MainScreen{public AnotherForm()

{        super();       

add(new LabelField("Another Form"));

}

}

Super Contributor
Posts: 308
Registered: ‎05-31-2011
My Device: Blackberry-SDK-9800
My Carrier: SimPakage 6.0.0.337_9800 asia.exe

Re: proplem to jump from one screen to another

hello PP,

    actually that icon of the blackberry project is not displayong in simulator.

     So may be i must install something with blackberry plugin.

   actully now i am in process to cofigure blackberry web development kit......

     thanks for reply, as u replyed me before also.. i remember.

Developer
Posts: 404
Registered: ‎05-31-2011
My Device: curve
My Carrier: devel

Re: proplem to jump from one screen to another

you must determine wich field in fieldChanged
public void fieldChanged(Field arg0, int arg1)
{
if(field == choice){
openAnotherForm();
}
}
Super Contributor
Posts: 278
Registered: ‎11-04-2010
My Device: 4.5 and above
My Carrier: none

Re: proplem to jump from one screen to another

Hi,
sorry. I taught java development and thats why replied.
next screen is pushed only when u change the item in
ObjectChoiceField

Thanks & Regards
pp
Super Contributor
Posts: 308
Registered: ‎05-31-2011
My Device: Blackberry-SDK-9800
My Carrier: SimPakage 6.0.0.337_9800 asia.exe

Re: proplem to jump from one screen to another

hello  friends,

may be code is not the problem, As the blackberry project where i write the code... if i run it in simulator, 

the icon is not displaying in simulator.....

To be clear,

         i created blackberry project "PushScreen" in eclipes blackberry....

the i create a class called "ScreenPush" under mypackage....

now if i run tha project in simulator.... the icon PushScreen must be displayed in simulator.....

 but i am not finding that icon itself, tocheck my code... 

Super Contributor
Posts: 308
Registered: ‎05-31-2011
My Device: Blackberry-SDK-9800
My Carrier: SimPakage 6.0.0.337_9800 asia.exe

Re: proplem to jump from one screen to another

oh god, i am so dump.... sorry for troubling u guys.. really sorry..

i was running program without writing main ... sorry sorry