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
mrdialect2012
Posts: 27
Registered: ‎05-10-2012
My Device: bold 9700
My Carrier: Vodafone

How do I push a new screen from a class that extends the mainscreeen

I basically just want a new screen which I have created to be used on a button click.?

Please use plain text.
Developer
pradeep_ch
Posts: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: How do I push a new screen from a class that extends the mainscreeen

[ Edited ]

You can push like this,

 

ButtonField bf = new ButtonField("Clickhere",ButtonField.CONSUME_CLICK);
        bf.setChangeListener(new FieldChangeListener() {
            
            public void fieldChanged(Field field, int context) {
                UiApplication.getUiApplication().pushScreen(new Myscreen());
                
            }
        });

 

Thanks,

 

Please use plain text.
Contributor
mrdialect2012
Posts: 27
Registered: ‎05-10-2012
My Device: bold 9700
My Carrier: Vodafone

Re: How do I push a new screen from a class that extends the mainscreeen

do i have to extend screen on my class, because that take constructor and of type manager needs to be put in?

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

Re: How do I push a new screen from a class that extends the mainscreeen

I don't really understand your question. 

 

You said "..  a new screen which I have created ....".

 

So just use your own Screen's constructor in here:

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

 

Please use plain text.