FileDocCategorySizeDatePackage
CommandState.javaAPI DocphoneME MR2 API (J2ME)4464Wed May 02 18:00:06 BST 2007com.sun.midp.main

CommandState

public class CommandState extends Object
Holds the state for MIDlet Suite management commands.

Fields Summary
static final int
MAIN_EXIT
return value from Main, so we know that Main exited normally
static final int
SHUTDOWN
status for shutdown
static final int
OK
status for success
int
status
Status of the last command.
int
suiteId
The ID given to a suite load.
String
midletClassName
Class name of MIDlet.
boolean
logoDisplayed
Has the application manager MIDlet displayed the Java logo yet?
int
lastSuiteId
The ID of suite to load when there is no other queued.
String
lastMidletClassName
The MIDlet class name for the suite to load.
String
lastArg0
The argument for a last MIDlet, will be app property arg-0.
String
lastArg1
The argument for a last MIDlet, will be app property arg-1.
String
arg0
The argument for a MIDlet in the suite, will be app property arg-0.
String
arg1
The argument for a MIDlet in the suite, will be app property arg-1.
String
arg2
The argument for a MIDlet in the suite, will be app property arg-2.
RuntimeInfo
runtimeInfo
Structure containing the run time information about the midlet.
Constructors Summary
private CommandState()
Only the factory method can instantiate this class


             
      
    
Methods Summary
static native voidexitInternal(int status)
Exit the VM with an error code. Our private version of Runtime.exit.

This is needed because the MIDP version of Runtime.exit cannot tell if it is being called from a MIDlet or not, so it always throws an exception.

param
status Status code to return.

static com.sun.midp.main.CommandStategetCommandState()
Get the command state.

return
current command state


                 
       
        CommandState state = new CommandState();

        restoreCommandState(state);
        return state;
    
private static native voidrestoreCommandState(com.sun.midp.main.CommandState state)
Restore the command state.

param
state current command state

voidsave()
Save the command state.

        saveCommandState(this);
    
private static native voidsaveCommandState(com.sun.midp.main.CommandState state)
Save the command state.

param
state current command state

public java.lang.StringtoString()
Returns the string form of this object.

return
displayable string representation of this object

        return "CommandState:" +
            "\n  status: " + status +
            "\n  suite ID: " + suiteId +
            "\n  class name: " + midletClassName +
            "\n  logo displayed: " + logoDisplayed +
            "\n  last suite ID: " + lastSuiteId +
            "\n  last MIDlet class name: " + lastMidletClassName +
            "\n  arg 0: " + arg0 +
            "\n  arg 1: " + arg1 +
            "\n  arg 2: " + arg2 +
            "\n  memory reserved: " + runtimeInfo.memoryReserved +
            "\n  memory total: " + runtimeInfo.memoryTotal +
            "\n  priority:" + runtimeInfo.priority +
            "\n  profile name: " + runtimeInfo.profileName;