How to listen to a closed screen event
Hi, do achieve the example that I gave to 2 screens, I would class to know when App screen1 is closed and act at this time, how can I do this?
import net.rim.device.api.ui.UiApplication; public class App extends UiApplication{ public static void main(String[] args) { App app = new App(); app.enterEventDispatcher(); } public App() { pushScreen(new Screen1()); pushScreen (new Screen2()); }}
Screen1.Java:
import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.MainScreen; final class Screen1 extends MainScreen{ public Screen1() { super(); setTitle(new LabelField("Screen1")); } public boolean onClose() { setDirty(false); return super.onClose(); } }
Screen2.Java:
import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.MainScreen; final class Screen2 extends MainScreen{ public Screen2() { super(); setTitle(new LabelField("Screen2")); } public boolean onClose() { setDirty(false); return super.onClose(); }}
Declare an interface:
public interface ScreenClosedListener { public void notifyScreenClosed(MainScreen screen); }
Add features to the Screen1 class.
import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.container.MainScreen; final class Screen1 extends MainScreen { private ScreenClosedListener listener; public Screen1(ScreenClosedListener listener) { super(); setTitle(new LabelField("Screen1")); this.listener = listener; } protected void onUndisplay() { listener.notifyScreenClosed(this); } protected boolean onSavePrompt() { // if you want to always close the screen // without questions just return true // there is no need in setDirty(false) // in onClose() method return true; } }
Add features to the App class, make the screen closed event listener
import net.rim.device.api.ui.UiApplication; public class App extends UiApplication implements ScreenClosedListener { // compose Screen1 instance and pass to the constructor // the reference to the App clas // which is ScreenClosedListener implementation private Screen1 screen1Instance = new Screen1(this); public static void main(String[] args) { App app = new App(); app.enterEventDispatcher(); } public App() { pushScreen(screen1Instance); pushScreen (new Screen2()); } public void notifyScreenClosed(MainScreen screen) { // check the event source object if (screen==screen1Instance) { // act accordingly here } } }
}
Tags: BlackBerry Developers
Similar Questions
-
How to detect the window closing event and to do some tasks before leaving
Hello
Someone knows how to detect the window closing event and to do some tasks before leaving?
Sridhar
Structure of the event allows to detect the window closing event. In the structure of the event,.
Select this VI-> close round table for this task. See attached picture.
-
How to listen for events from the Orientation
In the process, when the events of the display orientation changes I need to do something, but I don't know how to get the change of Orientation event
Please see this link https://developer.blackberry.com/cascades/documentation/dev/orientation/
-
How do I get a full screen when I connect to the internet, my screen appears1/4 screen when I connected mthen should maximize it?
Three options.
1: take the corners of the window and drag it to the format full screen. Do not use to expand. Close all other windows first via the taskbar and the latter. Windows will remember the size of the last closed window the next time that you open the program.
2: any shortcut you use to launch the window, right-click, and select Properties. Under the 'Run' drop-down list, choose "expanded".
3: IE New Window Maximizer
http://www.MajorGeeks.com/IE_New_Window_Maximizer_d1746.html -
How to stop the blue e screen to start the computer and also if you try to download anything
Remember - this is a public forum so never post private information such as numbers of mail or telephone!
How to stop the blue e screen to start the computer and also if you try to download anything:
- You have problems with programs
- Error messages
- Recent changes to your computer
- What you have already tried to solve the problem
Hello
We need numbers BBCode or Code to stop the bluescreens and utilities below will help you
provide us information. Also the methods here can help you solve the bluescreens.Look in the Event Viewer to see if something is reported on those.
http://www.computerperformance.co.UK/Vista/vista_event_viewer.htmMyEventViewer - free - a simple alternative in the standard Windows Event Viewer.
TIP - Options - Advanced filter allows you to see a period of time instead of the entire file.
http://www.NirSoft.NET/utils/my_event_viewer.html-------------------------------------------------------------------------
Here are a few ways to possibly fix the blue screen issue. If you could give the info from the blue screen that would be
Help. Such as ITC and 4 others entered at the bottom left. And any other information such as STOP error
codes and info like IRQL_NOT_LESS_OR_EQUAL or PAGE_FAULT_IN_NONPAGED_AREA and similar messages.As examples:
BCCode: 116
BCP1: 87BC9510
BCP2: 8C013D80
BCP3: 00000000
BCP4: 00000002or in this format:
Stop: 0 x 00000000 (oxoooooooo oxoooooooo oxoooooooo oxooooooooo)
Tcpip.sys - address blocking 0 x 0 00000000 000000000 DateStamp 0 x 000000000It is an excellent tool for displaying the blue screen error information
BlueScreenView scans all your minidump files created during "blue screen of death," collisions
http://www.NirSoft.NET/utils/blue_screen_view.html
Displays information on all the "crash" of a table - freeBlueScreens many are caused by old or damaged drivers, video drivers in particular, but there are other causes.
You can follow these steps in the Safe Mode if necessary or the command prompt Vista DVD or Options of recovery if your
system installed by the manufacturer.This tells you how to access the System Recovery Options and/or a Vista DVD
http://windowshelp.Microsoft.com/Windows/en-us/help/326b756b-1601-435e-99D0-1585439470351033.mspxYou can try a system restore to a point before the problem started when one exists.
How to make a Vista system restore
http://www.Vistax64.com/tutorials/76905-System-Restore-how.html-------------------------------------------------------------------------
Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN
Enter this at the command prompt - sfc/scannow
How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
generates in Windows Vista cbs.log
http://support.Microsoft.com/kb/928228The log can give you the answer if there is a corrupted driver. (Says not all possible driver problems).
Also run CheckDisk, so we cannot exclude as much as possible of the corruption.
How to run the check disk at startup in Vista
http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html-------------------------------------------------------------------------
Often drivers up-to-date will help, usually video, sound, network card (NIC), WiFi, 3rd party keyboard and
smile, as well as of other major device drivers.Look at the sites of the manufacturer for drivers - and the manufacturer of the device manually.
http://pcsupport.about.com/od/driverssupport/HT/driverdlmfgr.htmHow to install a device driver in Vista Device Manager
http://www.Vistax64.com/tutorials/193584-Device-Manager-install-driver.htmlHow to disable automatic driver Installation in Windows Vista - drivers
http://www.AddictiveTips.com/Windows-Tips/how-to-disable-automatic-driver-installation-in-Windows-Vista/
http://TechNet.Microsoft.com/en-us/library/cc730606 (WS.10) .aspx-------------------------------------------------------------------------
How to fix BlueScreen (STOP) errors that cause Windows Vista to shut down or restart unexpectedly
http://support.Microsoft.com/kb/958233Troubleshooting, STOP error blue screen Vista
http://www.chicagotech.NET/Vista/vistabluescreen.htmUnderstanding and decoding BSOD (blue screen of death) Messages
http://www.Taranfx.com/blog/?p=692Windows - troubleshooting blue screen errors
http://KB.wisc.edu/page.php?id=7033-------------------------------------------------------------------------
In some cases, it may be necessary.
The Options or Vista recovery disk Startup Repair
How to do a startup repair
http://www.Vistax64.com/tutorials/91467-startup-repair.htmlThis tells you how to access the System Recovery Options and/or a Vista DVD
http://windowshelp.Microsoft.com/Windows/en-us/help/326b756b-1601-435e-99D0-1585439470351033.mspxI hope this helps.
Rob - bicycle - Mark Twain said it is good. -
How to listen to changes in components of child in the parent MXAdvancedDataGridItemRenderer
How to listen to changes in components of child in the parent? I won't listen to the < s:change > to events triggered in each of the three components
< s:MXAdvancedDataGridItemRenderer >
list change ot here events->
< s:DropDownList x = "0" width = "120" dataProvider = "{DataUn}" id = "ddl" labelField = "name" >
< s:change > /pas in there
< / s:DropDownList >"{< mx:DateField id ="midYearReviewDate"ToolTip = 'Mid year review date' selectedDate="@{data.midYearReviewDate} ' = '125' XY '0' = >
< / mx:DateField >
"{< mx:DateField id ="endYearReviewDate"toolTip = selectedDate="@{data.endYearReviewDate ' year review end date "}" x = "222" >
< / mx:DateField >
< / s:MXAdvancedDataGridItemRenderer >Take a look at the documentation here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/events/FlexEvent.htm l #DATA_CHANGE . By default, bubbles is set to false for DATA_CHANGE.
In any case, add listeners for events within an element make as is generally a bad idea. Flex will allow to recycle a renderer instance only element to display several rows in your datagrid control. What you want to do is rather to add an event listener in the parent who answers to a custom event, that leave you the room from your rendering engine inside.
So in your parent, you should have:
public void init (): void {addEventListener ("myEvent", myHandlerFunction, true)};
and then inside the rendering engine:
change = "{dispatchEvent (new Event ('myEvent', true, false))}" / >
change = "{dispatchEvent (new Event ('myEvent', true, false))}" / >
-
How to listen to music, if we have a normal headset and charge at the same time?
< re-titled by host >
It sopposed must be a wireless charging dock to be launched shortly if the dock does not so it is a disappointment
-
How to listen to music offline in the iphone?
How to listen to music offline in the iphone?
This article will help you to Add music to the music catalog to Apple to your library on your iPhone, iPod touch, Mac, or PC - Apple Support
-
How to return to the main screen after watching downloads?
This such a stupid question, but I have forgotten how to return to the main screen after watching downloads.
Close the window or tab to download (if you are using some addon) or only to change the tab:
Downloads:
-
How can enlarge everything on the screen to 125% or even 150% as you can do in Google?
CTRL + will enlarge the page.
You can set also permanently this by installing the NoSquint add-on.
-
How to disable the mode full screen
The toolbar has disappeared. Can you tell me how to disable the mode full screen? Apparently this is going to give back me the toolbar.
F11 activates / deactivates the mode full-screen.
Versions of Firefox 3.6 + have a feature to allow the user to hide the Menu bar.
Press the Alt key to temporarily show the Menu bar, then open view > toolbars and select menu bar, so it has a check mark.
The F10 can also be used on most PCs to temporarily reveal the menu bar. -
How to keep the Macbook pro screen and cin on position?
How to keep the Macbook pro screen and computer in position 'on '. I don't want the computer shuts down or cut unless I ask him to...
If you talk to keep your machine to fall asleep, take a look at the caffeine.
-
I'm doing iPhoto my screen saver and I am not given the choice, when I click on "Source". iPhoto is grayed out. How can I make iPhoto my screen saver? I'll just put up my new iMac.
As a guess I think you need to import your iPhoto library in Photos and chose the photo library.
-
How to listen to local FM radio on Atrix 2
OK, I know I sound dumb, but I can't understand how to listen to the local radio. I have the headphones plugged in and open the app 'my music '. All I see is Now Playing, my library, music store, Internet radio and DLNA servers. None of these options allow me to scan local radio. I do not see the FM radio app under my app Manager, but I can't figure out how to open it. When I click it it just gives me the specifications of the application and the ability to stop it. I hope someone can help me with this.
On the bottom is a circle with 6 points in there. Tap it. It's the app drawer. The application manager does not launch apps. After opening the app drawer is of course applications is displayed at the top left. It should appear as a FM Radio.
-
How can I enter BIOS compaq610 screen and set the date, time
How can I enter BIOS compaq610 screen and set the date, time
Hello
See Page 94 or Page 100 (according to what's relevant) of your & Maintenance Guide.
Kind regards
DP - K
Maybe you are looking for
-
Satellite L350 - How can I use my recovery disk?
I have a Satellite L350 and you must return to the original settings. I created a recovery disc but don't know what to do from here.
-
Satellite M40X-189: screen seems crushed
I used the function SPACEBAR keys to zoom on a screen that had very small print. When I did it again to return to the initial display, it didn't quite back to normal - each screen now seems a little overwritten, which means that different and slightl
-
: 4620 all-in-one OfficeJet on 24/7
Y at - it hurt to leave my OfficeJet 4620 turned on 24/7?
-
Why are some of my file names have black fonts and some in the same folder have blue fonts?
In the same folder, some of my file names appear suddenly in blue font and others in black letters. What is the meaning of the different colored fonts?
-
NVIDIA Windows Kernel Mode driver version 188.67 has only ressponding and recovered.
I get this message after my screen goes black, then 'restart '. Is there a driver to update is necessary? If I do, where can I find? If this isn't the answer, what is? Help! How can I fix?