Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8371171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:05:50+00:00 2026-06-09T14:05:50+00:00

Hi I have two screens which I never wanna pop because they load data

  • 0

Hi I have two screens which I never wanna pop because they load data from the web and I don’t wanna load it all the time. However if I try to navigate from one to another I get a RuntimeException saying that I tried to push a screen that was already displayed. Is there a work around to pushScreen? Something like change screen?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:05:51+00:00Added an answer on June 9, 2026 at 2:05 pm

    You could certainly do what Rupak and Richard are suggesting. But, let me offer another option, that might require less redesign from what you currently have.

    It sounds like you’re doing some expensive operation when a Screen is instantiated, right? And you want to avoid doing that multiple times?

    Are you pushing your screens like this:

    UiApplication.getUiApplication().pushScreen(new FooScreen());
    
    UiApplication.getUiApplication().pushScreen(new BarScreen());
    

    Instead, make sure wherever you push screens saves the screen, to be reused later (at least for these two screens you think should not be popped). I usually have something like a ScreenController class to handle this. So, you could do this:

    if (_fooScreen == null) {
        _fooScreen = new FooScreen();
    }
    UiApplication.getUiApplication().pushScreen(_fooScreen);
    

    …

    UiApplication.getUiApplication().pushScreen(_barScreen);
    UiApplication.getUiApplication().popScreen(_fooScreen);  // popped but still referenced
    

    …

    UiApplication.getUiApplication().pushScreen(_fooScreen); // pushed, but not recreated
    

    You’re not recreating the screen every time you want to push it, or destroying its state when you pop it.

    If this really isn’t what you want, and you’re convinced that your two screens should really never be popped, then maybe they shouldn’t be Screens at all. Maybe they should be Manager subclasses.

    Maybe you only have one Screen (not two), which logically manages the content of both of what you originally had as two separate screens. So, to toggle between them, you would simply have the single Screen do this:

    add(_fooManager);
    remove(_barManager);
    

    or

    replace(_barManager, _fooManager);   // logically similar to "changing" screens
    

    Screens fundamentally are built to use push and pop semantics. If that doesn’t work for you, just use Manager subclasses. Since Screen extends Manager, that should involve minimal code changes to refactor this way.

    You do lose some of the nice transition features for switching screens. However, since I had to write BlackBerry code before those were available, I already learned to rely on alternative techniques, such as this one for animating the switching of Fields

    Fully separating the View layer, from a Controller layer, is often the way to go. However, especially for BlackBerry apps, I do believe that there are some times when adhering too strictly to an MVC architecture just increases code bloat and maintenance, and isn’t really necessary to solve problems like you describe.

    Anyway, just a thought.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two screens the one which list the records in a listview ListView
I have created TWO screens which i will paste the code below. `FirstScreen:` i
I have two screens on my app that I want to present to users,
i am self_learner to android. I have two screens.The first screen contains one edittext
I have two templates for my HTML email: one for bigger screens, and one
I've been using the Caliburn.Micro framework lately. I have a ShellView and two screens,
I have selected two components in the Customize Layout screen using a hint from
I have a page with two div s on it which should fill the
First of all, I'm using sIFR3, r419 (I can't upgrade since I don't have
I have two screens plugged into my computer and was wondering if there was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.