com.sun.midp.midlet

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.midp.midlet 
com.sun.midp.midlet
Provides the functions of the runtime management of MIDlets and suites in conjunction with the javax.microedition.midlet package.

For security purposes the MIDletStateHandler is the anchor of trust internally for the MIDP API, restricted methods obtain the MIDletStateHandler for a MIDlet suite in order to check the properties and actions of a suite. Because of this, there MUST only be one a MIDlet suite per MIDletStateHandler.

MIDlet State Handing

The MIDletStateHandler handles state transitions for a MIDlet. MIDP Optimized Implementation software has more states than those listed in the MIDP Specification (which are paused, active, and destroyed). The additional states are active pending, pause pending, and destroy pending. The state processing for a MIDlet is described in the table and illustrated in figure below.

State Description
Active Pending The starting state. For MIDlets in this state, the MIDlet state handler moves the MIDlet to the active state, and calls the MIDlet's startApp method.
Active For MIDlets in this state, the MIDlet state handler does nothing. A MIDlet leaves the active state because of an event outside the MIDlet state handler, such as the user exiting the MIDlet.
Pause Pending For MIDlets in this state, the MIDlet state handler moves the MIDlet to the paused state and calls the MIDlet's pauseApp method.
Paused For MIDlets in this state, the MIDlet state handler does nothing. A MIDlet leaves the active state because of an event outside the MIDlet state handler, such as the MIDlet requesting its reactivation.
Destroy Pending For MIDlets in this state, the MIDlet state handler moves the MIDlet to the destroyed state and calls the MIDlet's destroyApp method.
Destroyed The final state. For MIDlets in this state, the MIDlet state handler removes the MIDlet from the list of running MIDlets.

Note - To save CPU time, if all of the running MIDlets are in either the paused or active state, the MIDletStateHandler stops and waits for a state change.

Pausing a MIDlet

A MIDlet can be placed in paused state by either the system or itself, as indicated by the figure above. A MIDlet pauses itself by calling its pauseNotify method. However, as of MIDP 2.0 there is no longer any reason for this to happen for the following reasons:

  • A MIDlet does not need to pause itself to give up resources like CPU time or the display. To give up the display a MIDlet should call the Display.setCurrent method with an null argument. To give up CPU time the MIDlet only has to end or block the threads it started. Another option is for the MIDlet to ask the system to start it in the future using the Alarm API. See the Push API in the MIDP Specification for information.
  • MIDlets that use a Canvas object suspend and resume threads it created based on the Canvas or CustomItem class's hideNotify and showNotify methods. They must not depend on startApp and pauseApp because the hideNotify and showNotify methods also get called when a MIDlet is paused and activated.

MIDlet can be paused if desired by a device manufacture by using the MIDletProxy class or the native application manager API. The common reasons for customizing a system to pause MIDlets are:

  • The system allows the user to launch more than one MIDlet but only has the resources to run one MIDlet. In this case, the system pauses the MIDlets that do not have the physical display until the current MIDlet gives up the display.
  • The OS is about to suspend the CPU time for the VM process (as opposed to ending the process). In this case, the system pauses all of the MIDlets and activates them again when the OS resumes CPU time for the VM process.
Java Source File NameTypeComment
MIDletEventConsumer.javaInterface This is the DisplayEventHandler/MIDletStateHandler contract for MIDlet events. This interface is to be implemnted by an event processing target for MIDlet events.
MIDletEventListener.javaClass Listener for MIDlet related events (state changes, etc).
MIDletEventProducer.javaClass This class provides methods to send events of types handled by MIDletEventConsumer I/F implementors.
MIDletLoader.javaInterface Abstracts the way different VMs load MIDlets from a suite's JAR.
MIDletPeer.javaClass MIDletPeer maintains the current state of the MIDlet and forwards updates to it.
MIDletStateHandler.javaClass The MIDletStateHandler starts and controls MIDlets through the lifecycle states. MIDlets are created using its no-arg Constructor.
MIDletStateListener.javaInterface The interface decouples the MIDlet state handler for the VM.
MIDletSuite.javaInterface Represents a MIDlet suite.
MIDletSuiteExceptionListener.javaInterface An interface to handle MIDlet suite exceptions.
MIDletTunnel.javaInterface This is the interface to "tunnel" across Java package namespace, and call the protected methods in the another package namespace.
PlatformRequest.javaInterface Abstracts the platform request functionality for each VM platform.
Scheduler.javaClass This class is here for the for JSR code that has not been updated to use the MIDletStateHandler for security checks.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.