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
Developer
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified
Accepted Solution

Screen not getting displayed

Hello all,
I am new to blackberry programming.
I am trying to display a screen on button click.I was successful in invoking one screen. 

I am using Blackberry Pearl 8100 simulator to test.
On another button click screen 2 is not getting displayed.
I have followed the same procedure to invoke.
Please help.

Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Screen not getting displayed

Hi  tejaswini,

 

Can you make your question little more clear.

Or you can post the code that you are trying.

 

Regards

Bikas

 


Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Screen not getting displayed

You have to use pushScreen(scrren) to display the screen on device.

What problem you facing when you push the second screen? Any exceptions?

 


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified

Re: Screen not getting displayed

I am able to push the screen from the Midlet of the application.

On my form , I have a button which will be displaying a new screen.

I am using fieldChangeListener to detect button press.

But its just not working for me. 

Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Screen not getting displayed

Hi  tejaswini,

 

Maybe you have not added  changeListener with the button.

 

For example:

ButtonField button1 = new ButtonField("TestButton1");
button1.setChangeListener(this);

 

I am sending you one sample class.

Hope this might help you.

 

 

import net.rim.device.api.ui.component.ButtonField; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.FieldChangeListener; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.Field; import net.rim.device.api.ui.UiApplication; class TestScreen extends MainScreen implements FieldChangeListener { TestScreen() { ButtonField button1 = new ButtonField("TestButton1"); button1.setChangeListener(this); ButtonField button2 = new ButtonField("TestButton2"); button2.setChangeListener(this); this.add(button1); this.add(button2); } /** * FieldChangeListener implementation. * indicated what button was clicked. * buttons are distinguished by their label * net.rim.device.api.ui.FieldChangeListener */ public void fieldChanged(Field field, int context) { String text = ((ButtonField)field).getLabel(); if(text.equals("TestButton1")) { UiApplication.getUiApplication().pushScreen(new TestScreen1()); } else if(text.equals("TestButton2")) { UiApplication.getUiApplication().pushScreen(new TestScreen12()); } else { } } }

 

 

Regards

Bikas

 

Developer
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified

Re: Screen not getting displayed

Hi again,

Thanks for the reply and code sample.

I have implemented fieldChangeListener in the same way as in sample code.

Whenever I click the button,instead of opening new screen "Full Menu" is displayed,which displays a close button which forces me to close the application.

Any solution?

Thanks in advance. 

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Screen not getting displayed

This thread will help you.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=11693&query.id=53...


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Screen not getting displayed

Hi  tejaswini,

 

Try adding the following code segment in your class:

 

protected boolean navigationClick(int status, int time) { fieldChangeNotify(0); return true; }

 


Regards

Bikas

 

Developer
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified

Re: Screen not getting displayed

[ Edited ]

Hey Bikas and BBDeveloper,

It worked!!!

Smiley Happy

 

Thanks a  lot... 

Message Edited by tejaswini on 05-07-2009 02:34 AM