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
Highlighted
Developer
Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified
Accepted Solution

Switching screen back and force

Hi all,

 

Can any one give me some ideas or examples to switch current screen to previous screen?

 

Thanks,

DK.

 

Developer
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: Switching screen back and force

If you used UiApplication.pushScreen then you can use UiApplication.popScreen to go back to the previous screen.
Developer
Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified

Re: Switching screen back and force

Richard,

 

Thanks for your reply. But I'm getting IllegalArgumentException on simulator.

 

Please see my code below:

----------------------------------------------------

 public void fieldChanged(Field field, int context) {

QueryResultScreen nextScreen;

StringBuffer sb =
new StringBuffer("Sending...");

//connThread.post(Globlas.main_url + "=2", getFieldData());

MessageScreen current;

current = (MessageScreen) UiApplication.getUiApplication().getActiveScreen();

if (current != null)

System.out.println("MessageScreen: calling QueryResultScreen()...");

if (Globals.btnMsgNext.getLabel().equals("Next"))

{

nextScreen =
new QueryResultScreen(current, connThread);

UiApplication.getUiApplication().pushScreen(nextScreen);

}

 

}

}

 -------------- called class ---------------------

 public QueryResultScreen(MessageScreen parent, ConnectionThread connThrd)

{

      

this.parent = parent;

this.connThread = connThrd;

 

 

---

---

 

}

 public void menuSelected(int id) <<< --- this is calling by trackwheelClick()

{

switch (id)

{

case 97: // go back

UiApplication.getUiApplication().popScreen(this.parent);

break;

case 98:

break;

case 99:

break;

case 100:

 

break; case 101:

System.exit(0);

break;

}

 

}

 

I don't know whether my code is right or not.

Please help me more...

 

Thanks,

DK

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Switching screen back and force

I presume that the following is the offending line?

 

UiApplication.getUiApplication().popScreen(this.parent);

 

I think you want to replace the above with:

UiApplication.getUiApplication().popScreen(this);  

Developer
Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified

Re: Switching screen back and force

Yes. I solved it.

Thank you so much.