MainScreen.close)

Hi guys.

I need to confirm some class screen problem.

So, I want to know that when you call MainScreen.close (), its object may be removed by the garbage collector?

The screen object is defined as a local variable.

Thank you.

I note that you say:

"Screen object is defined as a local variable.

To elaborate a bit on what it says RexDoug, even if you have a local variable, pointing to the object of the screen, you must always reference and so the garbage collector can not release it.  If the local variable points to a screen that will never be used again, then you could dereference it (i.e. the value of your variable local null), which then allows the garbage collector to release.  This of course will happen automatically, if your variable is in a block that is left.

Tags: BlackBerry Developers

Similar Questions

  • cannot run this KeyListener on a real device

    I found a strange problem, I can't run this on my "BOLD" KeyListener function only if I deleted KeyListener.When I press "OP" of the option of the device, it is impossible to disseminate the next screen to view it.

    But it works well in the 9000,8900,8700 Simulator and perhaps others. I use JDE debug to attach my "BOLD" and get an exception of unknow error in statusbar of JDE. 'step 1' can be outprint on debug output.

    my code is as below:

    class op implements OptionsProvider {
        public op(){
        }
        public String getTitle() {
           return "Op";
        }
        public void populateMainScreen(MainScreen mainScreen) {
                   LabelField l1= new LabelField("label");
                   mainScreen.add(l1);
                   System.out.println("step 1");
                   mainScreen.addKeyListener(new KeyListener() {
    
                   public boolean keyChar(char key, int status, int time) {
                         return false;
                   }
                   public boolean keyDown(int keycode, int time) {
                         return false;
                   }
                   public boolean keyUp(int keycode, int time) {
                         return false;
                   }
                   public boolean keyRepeat(int keycode, int time) {
                         return false;
                   }
                   public boolean keyStatus(int keycode, int time) {
                         return false;
                   }
            });
        public void save() {
        }
    }
    

    Also the same code can be run except OptionsProvider.

    Y at - it combined a bug with the software?

    I use a similar approach to peter, only without button. My optionsproviderimpl code:

    xxx.showOptions ();
    UiApplication.getUiApplication () .invokeLater (new Runnable() {}
    public void run() {}
    mainScreen.close ();
    }
    });

  • Is there a public api Api to check that the cursor is open or close for blackberry 6.0?

    Hi all

    is there an api to check the slider is open or close for Blackberry JDE 6.0.

    Thank you

    Navneet Gupta.

    Hi you

    First of all "accept the solution please...." »

    See this link for more information...

    http://www.BlackBerry.com/developers/docs/4.6.0api/NET/rim/device/API/system/sensor.html

    Net.rim.device.api.system import. *;
    Import net.rim.device.api.ui.UiApplication;
    Import net.rim.device.api.ui.component.RichTextField;
    Import net.rim.device.api.ui.container.MainScreen;

    SerializableAttribute public class SensorDemo extends UiApplication
    {
    public SensorDemo()
    {
    Screen SensorDemoScreen = new SensorDemoScreen();
    pushScreen (screen);
    }
    Public Shared Sub main (String [] args)
    {
    SensorDemo app = new SensorDemo();
    app.enterEventDispatcher ();
    }
    class SensorDemoScreen extends screen implements the SensorListener
    {
    private RichTextField statusField1;
    private RichTextField statusField2;

    public SensorDemoScreen()
    {
    setTitle ("sensor Demo");
    statusField1 = new RichTextField();
    statusField2 = new RichTextField();
    Add (statusField1);
    Add (statusField2);

    Check for the presence of a sensor
    Boolean hasFlipSensor, hasHolsterSensor, hasSliderSensor;
    hasFlipSensor = Sensor.isSupported (Sensor.FLIP);
    hasHolsterSensor = Sensor.isSupported (Sensor.HOLSTER);
    hasSliderSensor = Sensor.isSupported (Sensor.SLIDE);
    statusField1.setText ("Flip:" + hasFlipSensor + "\nHolster:")
    + hasHolsterSensor + "\nSlider:" + hasSliderSensor + "\n"); "."
    Check the status of a sensor
    If (Sensor.isSupported (Sensor.SLIDE))
    {
    int sliderState = Sensor.getState (Sensor.SLIDE);
    Switch (sliderState)
    {
    case Sensor.STATE_SLIDE_CLOSED:
    do something if the cursor is closed
    statusField2.setText ("cursor is closed.");
    break;
    case Sensor.STATE_SLIDE_IN_TRANSITION:
    do something about cursor in transition
    statusField2.setText ("Slider is between open and closed.");
    break;
    case Sensor.STATE_SLIDE_OPEN:
    do something if the cursor is open
    statusField2.setText ("slider is open.");
    break;
    by default:
    statusField2.setText ("cannot determine the State of the cursor from.");
    }
    }
    Listening to changes to a sensor
    Sensor.addListener (Application.getApplication (),)
    Sensor.SLIDE);
    }

    implementation of the SensorListener.onSensorUpdate)
    change cursor only checks
    ' public void onSensorUpdate (int sensorID, int update)
    {
    If (sensorID is Sensor.SLIDE)
    {
    If (update is Sensor.STATE_SLIDE_OPEN)
    {
    do something if the cursor is now open
    statusField2.setText ("Slider is now open.");
    }
    ElseIf (update == Sensor.STATE_SLIDE_IN_TRANSITION)
    {
    do something if the cursor is now transitioning
    statusField2.setText ("Slider condition changes.");
    }
    ElseIf (update == Sensor.STATE_SLIDE_CLOSED)
    {
    do something if the cursor is now closed
    statusField2.setText ("Slider is now closed.");
    }
    }
    }
    }
    }

    .................

    Manoj Kumar bakkar

  • A screen to close after a transition of the screen

    Hi, I set up a transition of the screen that, once called by navigationClick, load a screen of the main menu. This is done via the following code

    package com.rim.breakoutapp;
    
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Manager;
    import net.rim.device.api.ui.Screen;
    import net.rim.device.api.ui.TransitionContext;
    import net.rim.device.api.ui.Ui;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.UiEngineInstance;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    public class Loading_Menu extends MainScreen {
        public Loading_Menu()
        {
            VerticalFieldManager backgroundManager = new VerticalFieldManager(Manager.USE_ALL_WIDTH|Manager.NO_VERTICAL_SCROLL|Manager.NO_VERTICAL_SCROLLBAR)
            {
                protected void paint(Graphics graphics) {
                    graphics.setBackgroundColor(0x0000A2E8);
                    graphics.clear();
                    super.paint(graphics);
                }
            };
            Bitmap appLogo = Bitmap.getBitmapResource("Breakout_Logo.png");
            BitmapField bmf = new BitmapField(appLogo, BitmapField.FOCUSABLE)
            {
                protected boolean navigationClick(int status, int time)
                {
    
                    Main_Menu newScreen = new Main_Menu();
                    UiEngineInstance engine = Ui.getUiEngineInstance();
                    UiApplication ui = UiApplication.getUiApplication();
    
                    Screen oldScreen = ui.getActiveScreen();
                    TransitionContext transitionContextIn = new TransitionContext(TransitionContext.TRANSITION_FADE);
                    transitionContextIn.setIntAttribute(TransitionContext.ATTR_DURATION, 3000);
    
                    engine.setTransition(null, newScreen, UiEngineInstance.TRIGGER_PUSH, transitionContextIn);
    
                    ui.pushScreen(newScreen);
                    oldScreen.close();
                    return true;
                }   
    
            };
    
            int leftMargin = (Display.getWidth() - bmf.getBitmapWidth()) >> 1;
            int topMargin = (Display.getHeight() - bmf.getBitmapHeight()) >> 1;
            int bottomMargin = ((Display.getHeight() - bmf.getBitmapHeight()) + 1) >> 1;
            bmf.setMargin(topMargin, 0, bottomMargin, leftMargin);
            backgroundManager.add(bmf);
            add(backgroundManager);
        }
    }
    

    I tried to close the screen with the Bitmap image on once the navigationClick was called using the oldScreen.close (); command. After having inserted the code however the transition of the screen stops working and simply loads the next page without fade. Can anyone suggest how to go on the first screen of closure AFTER deletion

    Thank you

    The usually cited way to do is this: Let's say you want invokeLater your declaration of oldScreen.close (). Instead of him, you're going to write something like

    UiApplication.getUiApplication().invokeLater(new Runnable() {
      public void run() {
        oldScreen.close();
      }
    });
    

    To avoid the compliation problems make your final oldScreen variable.

  • How to close the pop-up screen with timer

    Hello

    How to close pop-up display with timer .assuming I want to close pop-up screen after 10 seconds please share code me complete.

    Hello

    See this sample program,

    import java.util.Timer;
    import java.util.TimerTask;
    
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.PopupScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    public class Example extends UiApplication {
        public static void main(String[] args) {
            Example app = new Example();
            app.enterEventDispatcher();
        }
    
        public Example() {
            pushScreen(new ExampleScreen());
        }
    
        private class ExampleScreen extends MainScreen {
            public ExampleScreen() {
    
                ButtonField but = new ButtonField("Click",ButtonField.CONSUME_CLICK);
                but.setChangeListener(new FieldChangeListener() {
    
                    public void fieldChanged(Field field, int context)
                    {
                        UiApplication.getUiApplication().pushScreen(new exmplePopup());
    
                    }
                });
    
                add(but);
            }
        }
    
        private class exmplePopup extends PopupScreen
        {
    
            public exmplePopup()
            {
                super(new VerticalFieldManager());
                GuestPop p=new GuestPop();
                add(p);
            }
    
            public class GuestPop extends VerticalFieldManager
            {
                public GuestPop()
                {
                    add(new LabelField("Hi How r u"));
    
                    Timer timer  = new Timer();
                     timer.schedule(new CountDown(), 5000);
                }
    
            }
    
            private class CountDown extends TimerTask {
                public void run() {
                    UiApplication.getUiApplication().invokeLater(new Runnable() {
    
                        public void run() {
                            UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
    
                        }
                    });
    
                }
            }
    
        }
    }
    

    Here, I've given 5 seconds.

    Thank you.

  • Can close the menu being hiden or override?

    Generally, the close menu item will close only the current screen. I want to now that he works for leaving the game. It is possible to replace this menu item. If this is not the case, can I hide it?

    Thank you very much!

    You can override the makeMenu() and add a narrow menu allowing to leave your application instead of using the default menu.

    And also overrire method onclose() If you want to do anything when you press ESC.

    Something like:

    import net.rim.device.api.ui.*;import net.rim.device.api.ui.component.*;import net.rim.device.api.ui.container.*;
    
    public class TestScreen extends MainScreen{    public TestScreen()     {        super();                    }
    
        // menu item for exit the application            private MenuItem exitMenu = new MenuItem("Close",100,10)    {        public void run()        {            System.exit(0);        }          };
    
        protected void makeMenu(Menu menu, int instance)    {                menu.add(exitMenu);
    
            // default menu        //super.makeMenu(menu, instance);    }
    
        //it will close the current screen    public boolean onClose()    {        this.close();        return true;            }        }
    

    Concerning

    Bika

  • Override the method close() screen

    When I close the GUI of my program part, substantive enforcement will also close, which I don't want to happen.

    How can I replace the close method of the screen who resides in a UiApplication?

    final class SyncMyGUI extends UiApplication {
    
        //class simplified for clarity
        SyncMyGUI() {
            MainScreen screen=new MainScreen();
            screen.setTitle(new LabelField(State.VERSION,LabelField.ELLIPSIS));
    
            //screen.onClose(); //How?
            pushScreen(screen);
    }
    

    For completeness, here are two samples.  Not tested or compiled, but the principles should be clear.

    Inner class:

    final class SyncMyGUI extends UiApplication {
    
        //class simplified for clarity
        SyncMyGUI() {
            MainScreen screen=new MainScreen() {
                public boolean onClose() {
                    // Your code in here
                }
            };
            screen.setTitle(new LabelField(State.VERSION,LabelField.ELLIPSIS));
    
            //screen.onClose(); //How?
            pushScreen(screen);
    }
    

    Class within the class:

    final class SyncMyGUI extends UiApplication {
    
        //class simplified for clarity
        SyncMyGUI() {
            MainScreen screen=new MyMainScreen();
            screen.setTitle(new LabelField(State.VERSION,LabelField.ELLIPSIS));
    
            //screen.onClose(); //How?
            pushScreen(screen);
        }
    
        public class MyMainScreen extends MainScreen {
            public MyMainScreen() {
                super();
            }
            public boolean onClose() {
                // Your code here
            }
        }
    }
    
  • Close() dominant?

    New here. At a half of Java.

    I have the code written below. I want to replace the screen (close) method. Can I do it? If so, how do I?

    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    
    public class SimpleScreenApp2 extends UiApplication
    {
        public static void main(String[] inArgs)
        {
           SimpleScreenApp2 ssa = new SimpleScreenApp2();
    
            ssa.enterEventDispatcher();
        }
    
        public void activate()
        {
            MainScreen ms = new MainScreen();
    
            ms.setTitle("My Application");
    
            MenuItem mi = new MenuItem("Click Me", 40, 40)
            {
                public void run()
                {
                    Dialog.alert("You clicked me");
                }
            };
    
            ms.addMenuItem(mi);
    
            this.pushScreen(ms);
        }
    }
    

    You will need to create your own class that extends screen - then you can override the method close() in your application.

  • Close my request after 5 seconds

    Hello

    When I run my application, there is a first screen that prompts the user to press a button to start the real application. But I want that after 5 seconds if no button is pressed, the application closes.

    I don't really know how to handle this! Could you help me with a code example please?

    Here is the code I use:

    import net.rim.device.api.system.*;import net.rim.device.api.util.*;import net.rim.device.api.ui.*;import net.rim.device.api.ui.component.*;import net.rim.device.api.ui.container.*;
    
    final class Test extends UiApplication {        public static void main(String[] args)     {            Test app = new Test();           app.enterEventDispatcher();  }
    
            Test()  {            pushScreen(new EditScreen());    }
    
       private class EditScreen extends MainScreen {        public EditScreen()      {            add(new EditField("Press the right or left convenience button.",""));        }
    
       protected boolean keyDown(int keycode, int time) {        if(keycode == 1245184 || keycode == 1376256)         {            System.out.println("Here I launch my application");          }            return super.keyDown(keycode, time); }      }}
    

    Thank you very much for your help!

    You can do this by using the Timer (java.util.Timer) class and the class TimerTask (java.util.TimerTask).

    See the javadoc for more details.

    Concerning

    Bika

  • It would do any harm to delete pictures? I hate this - not even close to opening.

    It would do any harm to delete pictures? I hate this - not even close to opening.

    Yes he would because it is part of the operating system and you can not remove it - you can ignore it and you can use Aperture 3.6 as long as it continues to operate (which stops a day) and you can use any photo software you want

    and the photo is no program consumers not professional software like Aperture, but it is very good and much better that iPhoto - many power Aperture (but certainly not all) have found an acceptable Organizer

    LN

  • Mail closes immediately on the iPhone 5

    With my last update of iOS, whenever I click on the icon it opens mail and then it stops immediately.   I don't see an error message. I seem to be other problems.

    10.0.2

    me487LL/A

    Hi Rick escape NJ,

    I understand that after the update to iOS 10.0.2, the Mail app is quit unexpectedly on your iPhone. In such a situation the steps described in the article in the link below can help to restore the functionality of the Mail application.

    If an application you have installed unexpectedly closes, unresponsive, or does not open

    See you soon!

  • Is it possible to close the titles so they load in RAM until I tell them?

    I want to build my Orchestra until I play on the instruments. He ends by 165 securities loading from above all Kontakt 5.
    My problem starts a little after I loaded my project. My CPU bird up before I even play. That is not surprising that many tracks but can I somehow closed the tracks in my project? So my computer don't have to load anything until I have to say. I am aware of the Frost farm of, lock, mute buttons. But none of them really close the tracks. Somehow, I want to be able to force my project to open without loading all my instruments until I have actually say this to load a specific track: Pei

    Maybe I'm just dreaming? And the only solution would be a bigger computer: Pei as 12 hearts haha...

    Thanks in advance,
    Michael

    Hmmm, keep them loading...

    And neither of the two below answer to your problem?

    When Show Advanced Tools is selected in the Advanced preferences pane, you can freeze one track, reducing the computing power required to read the title. A reduced freezing track usage of the CPU than a track high-resolution audio without effects plug-ins, regardless of the number or complexity of plug-ins actually used on the track. Freezing is especially useful for software instrument tracks and audio tracks that use complex effects. Freezing is not available for software instruments several outputs.

    When you freeze a track, the track is rounded to an audio file. The gel file includes the output of any plug-ins on the track and any automation track. While the track is frozen, the gel file reads instead of the original track, which is temporarily disabled (including plug-ins). The channel strip controls (for example track mute and solo) are available, but no content track cannot be changed (including mute of the region and solo, for example).

    Even if a track is frozen, it cannot be changed. If you want to change the track, you can free an it, make the changes and then freeze again the track.

    Gel is designed to work around very CPU process, as software instruments with an architecture complex voice and complex plug-ins (such as reverb, filters or effects by FFT). If your computer allows to calculate all the active processes in real time, the titles of freezing is not necessary. Freeze tracks is recommended when the securities with processor software instrument or effects plug-ins are in a final State, or require no subsequent change.

    In freezing the slopes, you can:

    • Use plug-ins or additional software or audio effects software instruments instrument of additional tracks, which would be normally impossible it would exceed the limits of the CPU of your computer processing.
    • Read the projects created on computers with more CPU power.

    Freezing a track

    1. Click the Freeze button in the header of the track. The lock will turn blue to indicate that the track is ready to freeze.
    2. In the track Inspector, choose a Freeze mode:
      • Source only: Freeze the track without any signal effect plug-ins. When selected, the Freeze button becomes solid. Note: This Freeze mode is useful when you use software instruments much the processor or flex modes.
      • Pre Fader: Freezes the signal of the track including all effects plug-ins. When selected, the Freeze button shows a point.
    3. Click on the Play button in the control bar.
    4. To unlock the track, click the Freeze button again.

    To change the State of freezing of several tracks, click and hold the Freeze of a track button, then drag the pointer upwards or downwards. The buttons of the freezing of all tracks are critics put you in the same condition.

    If you try to make changes to a frozen track, a dialog box tells you that the track is frozen.

  • macOS Sierra close

    Hello

    After the update for Sierra, my MacBook Pro does not turn off. It Stucks in a black screen and I have to manually close with of button / stop.

    Does anyone else have the problem or knows a solution?

    Memo

    Try to quit all running applications before shutting down your computer.

    See also this article 3 http://www.macworld.co.uk/how-to/mac-software/fix-mac-that-wont-shut-down-359734 /

  • Activity monitor close unexpectedly when running in the background on the left

    Recently upgraded to Mac OS Sierra and Activity Monitor to close unexpectedly when running back plan left (do not smoke and open the activity monitor window) to a blank desktop when you use an application in another office. Clean install I tried but the activity monitor would still be down at random times when left running in the background to another empty office. Someone at - there experience this problem? For most browsing on the web using Safari on another desktop computer when Activity Monitor quit unexpectedly.

    Activity monitor also using a lot of energy since the upgrade?

    Any help would be appreciated. Thank you.

    Model: MacBook Pro (retina, 13 inches, early 2015)

    OS: macOS Sierra: 10.12 (installed via the upgrade, own installed after this problem).

    Do not forget that you are using the activity monitor version which was installed when you upgraded to Sierra. Activity monitor located in the your Mac utilities folder.

    If you have moved a previous version to a different location, it will not work.

    If you are using the correct version, post crash report. Error reports lies in the application of the Console under System reports or reports from usersand end in the suffix .crash. If you choose to do so, omit or hide any information that you consider personal.

  • After IOS 10.0.2, camera will not close

    Just did the upgrade to the new IOS, and now everytime I open my phone or my pad, the camera is open and will not close. Reboots do not help.

    Hello. Can you explain more? You open the smart cover or click on the Home button and immediately see the camera? You should see the lock with a message screen to press home to open. The lock screen is now configured with the page today (widgets) on the left and on the right camera, so you can drag to get access without having to open the iPad. If you enter the camera, by error, by clicking on home leaves you.

Maybe you are looking for

  • Satellite R630 - Message about the update driver WLAN

    I get the message driver LAN Wireless update. Have tried several times but still get the same result, messgae I need to update my driver wireless lan. Appreciate any help

  • Get the label name XControl leave XControl

    Hi all Is it possible to get in the name of the label of an XControl placed on a front panel from inside the XControl? I want to put some labels in the façade XControl name assigned to the XControl on a façade. Thank you

  • XW6600 box MOD not video

    I'll try to make this short. I bought a new motherboard XW6600 with: Two Xeon 5160 4 GB of RAM (and four others I bought later) A XW8600 PSU I have with a modified Extender I've done (plan I did below). Two Seidon Cooler Master 120 v with an adapter

  • cancellation of photoshop

    I googled how to cancel but non of them seem to help.

  • At the start of the ODC: error 20036: Description of error: ORA-06413: connection not open

    Hi allI am new to Oracle Document Capture. I installed ODDC on my windows 7 machine and launching that I gave a few local DB references. Since then, I'm not able to open Capture of Document Oracle and I'm not able to change any installation. I am sti