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: 38
Registered: ‎02-04-2009
My Device: 9530

ChoiceInPlaceScreen from ObjectField

[ Edited ]

Hey guys,

 

I'm trying to pop off a screen using UiApplication.getUiApplication().getActiveScreen(). But if the user has an ObjectChoiceField in select mode, the screen on top is called a ChoiceInPlaceScreen from class net.rim.device.api.ui.component.ChoiceInPlaceScreen.

I used ((Object)UiApplication.getUiApplication().getActiveScreen()).getClass() to figure out what screen was on top.

I looked at the API (4.7) and I'm using the Blackberry JDE (4.7) which shows me the available options for each class, and they both say there is no such thing.

 

Basically want I'm trying to do is this:

                    if (UiApplication.getUiApplication().getActiveScreen() instanceof ChoiceInPlaceScreen)
                    {
                        UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
                        SpecialScreen scrn = (SpecialScreen)(UiApplication.getUiApplication().getActiveScreen());
                        scrn.recreate();
                    }

I'm trying to close the ChoiceInPlaceScreen so I can get to the screen behind it to recreate it. But the problem is I cannot even compile this because it doesn't know what  ChoiceInPlaceScreen is.  I am importing net.rim.device.api.ui.component.*;  but it makes no difference.

(Simulator: Storm 9530)

Any ideas?

Message Edited by azdragon2 on 08-14-2009 11:49 PM
Highlighted
Developer
Posts: 38
Registered: ‎02-04-2009
My Device: 9530

Re: ChoiceInPlaceScreen from ObjectField

Well I fixed my program to avoid this ChoiceInPlaceScreen, but its not really a perfect solution. What I did is I changed all my screens to be a new type, lets call it, SpecialScreen extending MainScreen. And then I could tell the difference like this (in a background thread):

 

                        if (UiApplication.getUiApplication().getActiveScreen() instanceof SpecialScreen)
                        {
                            SpecialScreenscrn = (SpecialScreen)(UiApplication.getUiApplication().getActiveScreen());                               

                                    scrn.recreate();
                        }
                        else if (UiApplication.getUiApplication().getActiveScreen() instanceof Screen)
                        {
                            UiApplication.getUiApplication().invokeAndWait(new Runnable()
                            {
                                public void run()
                                {
                                    try
                                    {
                                        UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
                                        SpecialScreen scrn = (SpecialScreen)(UiApplication.getUiApplication().getActiveScreen());
                                        scrn.recreate();
                                    }
                                    catch(Exception e)
                                    {
                                        System.out.println("CERROR: " + e.toString());
                                    }
                                }
                            });
                        }

 

Its partially a way around without using  ChoiceInPlaceScreen by making everything else a new type, but anyone have a real solution?