Class Settings
- java.lang.Object
-
- totalcross.sys.Settings
-
public final class Settings extends java.lang.Objectthis class provides some preferences from the device configuration and other Vm settings. All settings are read-only, unless otherwise specified. Changing their values may cause the VM to crash.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanabortedOnLastRunField set to true if the program have aborted on last run.static java.lang.StringactivationIdREAD-ONLY unique identifier available for registered applications after the TotalCross VM is activated.
Value defaults to "NOT AVAILABLE" when running on DEMO, and "NO ACTIVATION" when using the new licensing model.static java.lang.StringactivationKeyThe activation key used during deploystatic java.lang.StringactivationServerNamespaceSet it at the application's static initializer.static java.lang.StringactivationServerURISet it at the application's static initializer.static booleanallowBackupApps that target Android 6.0 (API level 23) or higher automatically participate in Auto Backup.static byteAndroidDeprecated.Use ANDROID_UI insteadstatic java.lang.StringANDROIDUnderlying platform is Android.static java.lang.StringANDROID_IDOn Android it has the value of Settings.Secure.ANDROID_ID.static byteANDROID_UIDefines an Android user interface style.static java.lang.StringappCategoryDeprecated.No longer used.static java.lang.StringappDescriptionDeprecated.static java.lang.StringapplicationIdThe application's ID.static java.lang.StringappLocationDeprecated.No longer used.static java.lang.StringappPackageIdentifierDeprecated.static java.lang.StringappPackagePublisherDeprecated.static java.lang.StringappPathThe path from where the application is running from.static HashtableappPropsSome properties you may want to use in the application.static java.lang.StringappSecretKeyApplication defined secret key.static java.lang.StringappSettingsApplication defined settings.static byte[]appSettingsBinApplication defined settings, stored as a byte array.static java.lang.StringappVersionSet it at the application's static initializer.static java.lang.StringBLACKBERRYDumb field to keep compilation compatibility with TC 1static java.lang.StringbugreportEmailAn email that will be used to send bug reports when an unhandled exception is caught on your application.static java.lang.StringbugreportUserSet this to the username of your application to be able to filter at the bug report service.static intbuildNumberCurrent build number for the TotalCross SDK.static intchunksCreatedNumber of memory chunks (blocks of memory that store Objects) created.static booleancircularNavigationSet to false to disable the default circular navigation when using the arrows: it will stop at the first or the last item.static intCLOSE_BUTTONTo be used in the closeButtonType.static intcloseButtonTypeSet it at the application's static initializer.static java.lang.StringcompanyContactDeprecated.static java.lang.StringcompanyInfoSet it at the application's static initializer; should not contain spaces.static IVirtualKeyboardcustomKeyboardstatic java.lang.StringdataPathSpecifies the directory where pdbs should be read/written.static byteDATE_DMYConstant used in dateFormat: day month yearstatic byteDATE_MDYConstant used in dateFormat: month day yearstatic byteDATE_YMDConstant used in dateFormat: year month daystatic bytedateFormatCan be one of the following constants: DATE_MDY, DATE_DMY, DATE_YMD; where m = month, d = day and y = yearstatic chardateSeparatorThe date char separator.static booleandaylightSavingsDeprecated.Use daylightSavingsMinutesstatic intdaylightSavingsMinutesDaylight savings minutes to add; will be 0 when not in daylight savings.static booleandebugEventsSet to true to debug all events that are received at Window._postEvent.static chardecimalSeparatorThe decimal separator for numbersstatic intdeviceFontHeightThe size in pixels of the device's system font.static java.lang.StringdeviceIdField that represents a device id that can be used to identify the device's name.static intdeviceRobotSpecialKeyMakes the generation of user interface tests much easier by using the built-in User Interface Robot.static booleandisableScreenRotationSet to true to disable screen rotation.static booleandontCloseApplicationDeprecated.Not used in any platformstatic booleanenableVirtualKeyboardSet to false to disable the virtual keyboard on all Edits and MultiEdits at oncestatic booleanenableWindowTransitionEffectsSet to true to enable the transition effects when a window is shown and hidden.static java.lang.StringesnField that represents the smartphone ESN (if this device is a CDMA smartphone) or null if there's none.static booleanfadeOtherWindowsDefault fadeOtherWindows value used in the totalcross.ui.dialog windows.static booleanfingerTouchDefines platforms that the touchscreen is used MOSTLY with the finger.static byteFlatDeprecated.Use FLAT_UI insteadstatic byteFLAT_UIDefines a FLAT user interface style, like the ones used in Pocket PC 2003.static java.lang.StringfullScreenPlatformsSet this to a list of platforms that will set the fullscreen mode.static intgcCountNumber of times that the GC ran.static intgcTimeHow much time the GC took in all runs.static booleangeographicalFocusWhen directional keys are used to change focus, the next control to receive focus will be determined based on their physical location on the screen.static byteHoloDeprecated.Use HOLO_UI insteadstatic byteHOLO_UIDefines an Holo user interface style.static java.lang.StringiccidField that represents the serial number of the GSM chip or null if there's none.static java.lang.StringimeiField that represents the smartphone IMEI (if this device is a GSM, UMTS or IDEN smartphone), or null if there's none.static java.lang.String[]imeisField that represents the smartphone IMEIs; used in phones with more than one line.static TimeiosCertDateThe due date of the iOS certificate.static java.lang.StringiosCFBundleIdentifierSet it at the application's static initializer.static java.lang.StringIPADUnderlying platform is iPad.static java.lang.StringIPHONEUnderlying platform is iPhone.static booleanis24HourTrue if the time format is 24 hour format or if it is the AM/PM formatstatic booleanisFullScreenSet it at the application's static initializer.static booleanisMinimizedDumb field to keep compilation compatibility with TC 1static booleanisOpenGLReturns true if this is an open gl platform (IOS or Android).static java.lang.StringJAVAUnderlying platform is Java.static booleankeyboardFocusTraversableDefines if the arrow keys will be used to change the focus using the keyboard.static booleankeypadOnlyDumb field to keep compilation compatibility with TC 1static intlastInteractionTimeTime when the user last interacted with the device using the keyboard, pen, trackball, etc.static java.lang.StringlineNumberReturns the line number of the device.static java.lang.StringLINUXUnderlying platform is Linux.static java.lang.StringmacAddressDeprecated.due to provide users with greater data protectionstatic byteMaterialDefines an user interface style.static byteMATERIAL_UIDefines an user interface style.static intminimalUpdateIntervalMinimal interval between two Update eventsstatic intMINIMIZE_BUTTONTo be used in the closeButtonType.static booleanmoveCursorToEndOnFocusSet to true to put the cursor at the end of the Edit and MultiEdit when focus was set to the control (default is at the end).static booleanmultipleInstancesSetting this field to true allows the execution of multiple instances of the same application.static intNO_BUTTONTo be used in the closeButtonType.static intnvfsVolumeDumb field to keep compilation compatibility with TC 1static booleanonJavaSEField that defines if running in Java Standard Edition (ie, in Eclipse or java in your desktop or even on an applet in a browser) instead of a handheld device.static booleanoptimizeScrollSet to false to disable the scroll optimization using images.static intoptionalBackspaceKeyAn optional value for the backspace key.static bytePalmOSDeprecated.Use Flat, Vista or Android.static java.lang.StringPALMOSDumb field to keep compilation compatibility with TC 1static java.lang.StringplatformField that returns the current platform name.static java.lang.StringPOCKETPCUnderlying platform is Pocket PC.static java.lang.StringpushTokenAndroidDeprecated.static booleanresizableWindowSet to true to make the program's window resizable in Windows and desktop.static java.lang.StringromSerialNumberField that represents the ROM serial number for this device.static intromVersionField that returns the ROM version of the device, like 0x02000000 or 0x03010000.static intscreenBPPField that represents if the device supports color.static doublescreenDensityThe logical density of the display, used as a scaling factor for density independent pixels (dp) and scaleable pixels (sp).static intscreenHeightField that represents the device's screen heightstatic intscreenHeightInDPIField that represents the device's screen vertical pixels density, in dots per inch (DPI).static intscreenWidthField that represents the device's screen widthstatic intscreenWidthInDPIField that represents the device's screen horizontal pixels density, in dots per inch (DPI).static intscrollDistanceOnMouseWheelMoveSet to 0 to disable the automatic scroll of the ScrollContainer under the mouse position when the mouse wheel changes.static booleansendPressEventOnChangeSet to true to post a PRESSED event when an item is programatically selected or changed.static booleanshowDebugTimestampSet to false to don't display the timestamp before each Vm.debug output.static booleanshowDesktopMessagesSet to false to hide all messages that are sent to the console when running at the desktop.static booleanshowMemoryMessagesAtExitSet this flag to false (default is true) to don't display the memory errors when the program exits.static booleanshowMousePositionShows the mouse position in the Window's title when running as Java SE application.static booleanshowSecretsDeprecated.This was only used in Palm OS, which is now unsupportedstatic booleanshowUIErrorsSet to false to disable UI positional errors that are shown in Java SEstatic intSIPBottomLimitThe limit that will make the Soft Input Panel be placed at bottom.static charthousandsSeparatorThe thousands separator for numbersstatic chartimeSeparatorThe time char separatorstatic inttimeZoneDeprecated.Use timeZoneMinutesstatic inttimeZoneMinutesTimezone in minutes.static java.lang.StringtimeZoneStrTextual description of the time zone currently used by the device.static inttouchToleranceDefines a touch tolerance to find the closest control.static booleanuiAdjustmentsBasedOnFontHeightSet to true to make the extra adjustment values used in the relative positioning be a percentage of the control's font height.static byteuiStyleField that stores the current user interface style.static booleanunmovableSIPSet to true to move an Edit or MultiEdit to the top of the screen if the application is running in a platform that does not support moving the Soft Input Panel to the top.static booleanuseNewFontDumb field to keep compilation compatibility with TC 1static java.lang.StringuserNameField that returns the username of the user running the Virtual Machine.static intversionField that represents the version of the TotalCross Virtual Machine.static java.lang.StringversionStrField that represents the version in a string form, like "1.36".static booleanvibrateMessageBoxSet to true to enable the vibration when a MessageBox appears on screen (only on device).static booleanvirtualKeyboardTrue if this handheld has a virtual keyboard, I.E., like the soft input panel in windows ce devices or in the Tungsten T|X.static byteVistaDeprecated.Use VISTA_UI insteadstatic byteVISTA_UIDefines a Windows Vista user interface style.static java.lang.StringvmPathThe main path used to derivetempPathandappPathand also to store TotalCross global files.static byteweekStartThe week day start.static java.lang.StringWIN32Underlying platform is desktop Windows.static byteWinCEDeprecated.Use Flat, Vista or Android.static intwindowFontDeprecated.Use at the application's constructor: if (Settings.platform.equals(Settings.WIN32)) setDefaultFont(Font.getFont(false,NN)); where NN is the desired font sizestatic intWINDOWFONT_12Used in the windowFont field; sets the size to 12.static intWINDOWFONT_DEFAULTUsed in the windowFont field; sets the size to the one defined by user.static java.lang.StringWINDOWSCEUnderlying platform is Windows CE.static intwindowSizeDefines the window size when running in a desktop computer (the default is 240x320).static intWINDOWSIZE_320X480Used in the windowSize field.static intWINDOWSIZE_480X640Used in the windowSize field.static intWINDOWSIZE_600X800Used in the windowSize field.static java.lang.StringWINDOWSMOBILEUnderlying platform is Windows Mobile.static java.lang.StringWINDOWSPHONEDeprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringappBuildNumber()Returns the application's build number.static intgetAnimationMaximumFps()static java.lang.StringgetUniqueId()Returns an id from the mobile device (Android and iOS) that should be persistent on reinstall.static booleanisIOS()Returns true if this is an iPad or an iPhone.static booleanisLandscape()Returns true if the device is currently in landscale (screenWidth > screenHeight).static booleanisWindowsCE()Returns true if the current platform is Windows Mobile or Windows Phone.static booleanisWindowsDevice()Returns true if the current platform is Windows Mobile or Windows Phone.static voidrefresh()Refresh some fields thay may have been updated since the program started.
-
-
-
Field Detail
-
version
public static int version
Field that represents the version of the TotalCross Virtual Machine. The major version is base 100. For example, version 1.0 has value 100. version 4 has a version value of 400. A beta 0.81 VM will have version 81.
-
versionStr
public static java.lang.String versionStr
Field that represents the version in a string form, like "1.36". Only digits and dot is allowed or an exception will be throws during tc.Deploy.
-
buildNumber
public static int buildNumber
Current build number for the TotalCross SDK.- Since:
- TotalCross 1.53
-
appProps
public static Hashtable appProps
Some properties you may want to use in the application. The file format must be:property=value<enter>
This file must be namedtcapp.propand it is searched from the current folder up to the root folder. To have a build number be incremented by tc.Deploy, just create the file somewhere in a parent folder from where you run tc.Deploy for your application. The file will be inserted into the application's tcz and you will be able to retrieve the build number usingSettings.appBuildNumber(). Note that the properties are always read-only and you can add other values to be used in your application.- Since:
- TotalCross 3.1
-
dateFormat
public static byte dateFormat
Can be one of the following constants: DATE_MDY, DATE_DMY, DATE_YMD; where m = month, d = day and y = year
-
dateSeparator
public static char dateSeparator
The date char separator.
-
weekStart
public static byte weekStart
The week day start. 0 = Sunday, 6 = Saturday
-
is24Hour
public static boolean is24Hour
True if the time format is 24 hour format or if it is the AM/PM format
-
timeSeparator
public static char timeSeparator
The time char separator
-
thousandsSeparator
public static char thousandsSeparator
The thousands separator for numbers
-
decimalSeparator
public static char decimalSeparator
The decimal separator for numbers
-
screenWidth
public static int screenWidth
Field that represents the device's screen width
-
screenHeight
public static int screenHeight
Field that represents the device's screen height
-
screenWidthInDPI
public static int screenWidthInDPI
Field that represents the device's screen horizontal pixels density, in dots per inch (DPI). Note that this value can be incorrect in many devices.
-
screenHeightInDPI
public static int screenHeightInDPI
Field that represents the device's screen vertical pixels density, in dots per inch (DPI). Note that this value can be incorrect in many devices.
-
screenBPP
public static int screenBPP
Field that represents if the device supports color. /** Field that represents the screen's number of bits per pixel.- Since:
- TotalCross 1.0
-
onJavaSE
public static boolean onJavaSE
Field that defines if running in Java Standard Edition (ie, in Eclipse or java in your desktop or even on an applet in a browser) instead of a handheld device.
-
romVersion
public static int romVersion
Field that returns the ROM version of the device, like 0x02000000 or 0x03010000. For Android, returns the version in decimal number (E.G.: 3.16 is returned as 316).
-
JAVA
public static final java.lang.String JAVA
Underlying platform is Java. To be used with theplatformmember.- See Also:
- Constant Field Values
-
WINDOWSCE
public static final java.lang.String WINDOWSCE
Underlying platform is Windows CE. To be used with theplatformmember.- See Also:
- Constant Field Values
-
POCKETPC
public static final java.lang.String POCKETPC
Underlying platform is Pocket PC. To be used with theplatformmember.- See Also:
- Constant Field Values
-
WINDOWSMOBILE
public static final java.lang.String WINDOWSMOBILE
Underlying platform is Windows Mobile. To be used with theplatformmember.- See Also:
- Constant Field Values
-
WIN32
public static final java.lang.String WIN32
Underlying platform is desktop Windows. To be used with theplatformmember.- See Also:
- Constant Field Values
-
WINDOWSPHONE
@Deprecated public static final java.lang.String WINDOWSPHONE
Deprecated.Underlying platform is Windows Phone. To be used with theplatformmember.- See Also:
- Constant Field Values
-
LINUX
public static final java.lang.String LINUX
Underlying platform is Linux. To be used with theplatformmember.- See Also:
- Constant Field Values
-
IPHONE
public static final java.lang.String IPHONE
Underlying platform is iPhone. To be used with theplatformmember.- See Also:
- Constant Field Values
-
ANDROID
public static final java.lang.String ANDROID
Underlying platform is Android. To be used with theplatformmember.- See Also:
- Constant Field Values
-
IPAD
public static final java.lang.String IPAD
Underlying platform is iPad. To be used with theplatformmember.- See Also:
- Constant Field Values
-
platform
public static java.lang.String platform
Field that returns the current platform name. The possible return values are the constants described below.
-
userName
public static java.lang.String userName
Field that returns the username of the user running the Virtual Machine. Because of Java's security model, this method will return null when called in a Java applet. This method will also return null under most WinCE devices (that will be fixed in a future release). In Windows 32, this will return the currently logged in user.
-
appSettingsBin
public static byte[] appSettingsBin
Application defined settings, stored as a byte array. If you set the value of this app to something other than null, the VM will save it when exiting and load it when restarting. Under PalmOS, the value is stored in the unsaved preferences database, which is not backed up during hot-sync. Use this to save small amount of data, up to 2 or 4 kb maximum. At desktop, a file named settings4crtr.pdb stores the appSettingsBin for the current running TotalCross programs. Here's a sample of how to use it:if (Settings.appSettingsBin == null) { add(new Label("empty"),CENTER,CENTER); ByteArrayStream bas = new ByteArrayStream(100); DataStream ds = new DataStream(bas); ds.writeDouble(1234.567); Settings.appSettingsBin = bas.getCopy(); } else { ByteArrayStream bas = new ByteArrayStream(Settings.appSettingsBin); DataStream ds = new DataStream(bas); double d = ds.readDouble(); add(new Label("d = "+Convert.toString(d,3)),CENTER,CENTER); Settings.appSettingsBin = null; }This property is saved only at application's exit; you can force an update by callingSettings.refresh().- See Also:
refresh()
-
appSettings
public static java.lang.String appSettings
Application defined settings. If you set the value of this app to something other than null, the VM will save it when exiting and load it when restarting. Under PalmOS, the value is stored in the unsaved preferences database, which is not backed up during hot-sync. Use this to save small strings, up to 2 or 4 kb maximum. At desktop, a file named settings4crtr.pdb stores the appSettings for the current running TotalCross programs. This property is saved only at application's exit; you can force an update by callingSettings.refresh().- See Also:
refresh()
-
appSecretKey
public static java.lang.String appSecretKey
Application defined secret key. If you set the value of this app to something other than null, the VM will save it when exiting and load it when restarting. Under PalmOS, the value is stored in the saved preferences database, which is backed up during hotsync. Use this to save small strings, up to 2 or 4 kb maximum. At desktop, a file named settings4crtr.pdb stores the appSettings for the current running TotalCross programs. The String is stored in the saved preferences with a creator id different of your application's (but calculated based in it), so it will never be deleted and will be restored even after a hard-reset.In Windows CE, the key is stored in the registry. This property is saved only at application's exit; you can force an update by calling
Settings.refresh().- See Also:
refresh()
-
applicationId
public static java.lang.String applicationId
The application's ID. MUST BE CHANGED IN THE STATIC INITIALIZER! Used by the deployer and by the virtual machine. In Palm OS, all data created is assigned to an application id. So when a program is uninstalled, all of its data is also removed from device. In Android, when the single package option is passed to tc.Deploy (/p), the application's package is changed to totalcross.app<application id>. It must have 4 letters or digits, and the first character must be a letter.
-
WinCE
@Deprecated public static final byte WinCE
Deprecated.Use Flat, Vista or Android. This user interface does not work on TotalCross 2.Defines a Windows CE user interface style. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
PalmOS
@Deprecated public static final byte PalmOS
Deprecated.Use Flat, Vista or Android. This user interface does not work on TotalCross 2.Defines a PalmOS user interface style. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
Flat
@Deprecated public static final byte Flat
Deprecated.Use FLAT_UI insteadDefines a FLAT user interface style, like the ones used in Pocket PC 2003. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
Vista
@Deprecated public static final byte Vista
Deprecated.Use VISTA_UI insteadDefines a Windows Vista user interface style. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
Android
@Deprecated public static final byte Android
Deprecated.Use ANDROID_UI insteadDefines an Android user interface style. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
Holo
@Deprecated public static final byte Holo
Deprecated.Use HOLO_UI insteadDefines an Holo user interface style. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
Material
public static final byte Material
Defines an user interface style. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
FLAT_UI
public static final byte FLAT_UI
Defines a FLAT user interface style, like the ones used in Pocket PC 2003. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
VISTA_UI
public static final byte VISTA_UI
Defines a Windows Vista user interface style. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
ANDROID_UI
public static final byte ANDROID_UI
Defines an Android user interface style. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
HOLO_UI
public static final byte HOLO_UI
Defines an Holo user interface style. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
MATERIAL_UI
public static final byte MATERIAL_UI
Defines an user interface style. Used in the uiStyle member.- See Also:
MainWindow.setUIStyle(byte), Constant Field Values
-
uiStyle
public static byte uiStyle
Field that stores the current user interface style. It must be set by calling Settings.setUIStyle.- See Also:
FLAT_UI,VISTA_UI,ANDROID_UI,HOLO_UI,MATERIAL_UI
-
DATE_MDY
public static final byte DATE_MDY
Constant used in dateFormat: month day year- See Also:
- Constant Field Values
-
DATE_DMY
public static final byte DATE_DMY
Constant used in dateFormat: day month year- See Also:
- Constant Field Values
-
DATE_YMD
public static final byte DATE_YMD
Constant used in dateFormat: year month day- See Also:
- Constant Field Values
-
daylightSavings
@Deprecated public static boolean daylightSavings
Deprecated.Use daylightSavingsMinutesField that represents if the device is in daylight savings mode.- Since:
- SuperWaba 3.4
-
daylightSavingsMinutes
public static int daylightSavingsMinutes
Daylight savings minutes to add; will be 0 when not in daylight savings. To compute the difference to GMT+0, use:int dif = Settings.timeZoneMinutes + Settings.daylightSavingsMinutes; int hours = dif / 60; int minutes = Math.abs(dif % 60);
- Since:
- TotalCross 2.0
-
timeZone
@Deprecated public static int timeZone
Deprecated.Use timeZoneMinutesField that represents the timezone used for this device. This is the number of hours away from GMT (E.g.: for Brazil it will return -3).- Since:
- SuperWaba 3.4
-
timeZoneMinutes
public static int timeZoneMinutes
Timezone in minutes. Some countries have a timezone difference in minutes, like Iran with 3:30. In this example, timeZoneMinutes will be 210. To compute the difference to GMT+0, use:int dif = Settings.timeZoneMinutes + Settings.daylightSavingsMinutes; int hours = dif / 60; int minutes = Math.abs(dif % 60);
- Since:
- TotalCross 2.0
-
virtualKeyboard
public static boolean virtualKeyboard
True if this handheld has a virtual keyboard, I.E., like the soft input panel in windows ce devices or in the Tungsten T|X.
-
dataPath
public static java.lang.String dataPath
Specifies the directory where pdbs should be read/written. Used in desktop when:- Running under Win32 VM. Can be specified anywhere.
- Running under JDK, as application (java.exe). Can also be specified with the
/dataPathcommandline parameter.
- If this member is not null, any paths specified for the file are replaced by this path.
- Slashes are normalized by the vm.
- The path existence is not verified on Win32.
- Changing this member also changes the place where local libraries are loaded (global libraries are loaded when the VM starts, before the app is initialized). So, before loading any library, change this member back to
null(unless the library is also in the dataPath). - The system ensures that the datapath ends with a slash, if you don't put one.
- Since:
- SuperWaba 4.11 (Win32) and 2.0beta4 (JDK)
-
romSerialNumber
public static java.lang.String romSerialNumber
Field that represents the ROM serial number for this device. Important!: don't rely only on this information to uniquely identify a device! Its very easy to change this number, and it won't be available in all devices. It will containnullif unavailable, such as in Windows CE 2.11 devices, Palm OS < 3.0, and even some Palm OS 5 devices, like Treo 6xx.Note: this was correctly tested; you can ensure that your Palm OS device has or not a serial number pressing App/Info/Version: the serial number will appear in the top; if nothing appears, it means that the device doesn't has a serial number. If it appears but nothing is returned from here, it means that the device has a non-standard function that retrieves the serial number, and thus we don't support it. In Android 3.0 or greater it will return the serial number; in Android 1.x and 2.x will return a consistent number that MAY be the same across resets, but has no relation to the real serial number.
-
macAddress
@Deprecated public static java.lang.String macAddress
Deprecated.due to provide users with greater data protectionThe macAddress currently in use. Currently works only on Android.
-
showSecrets
@Deprecated public static boolean showSecrets
Deprecated.This was only used in Palm OS, which is now unsupportedField that represents if the PDA has a password and the user choosen to hide the secret records (via the Apps/Security/Current Privacy). Returns true in all other cases. Specific for Palm OS (Windows CE does not let the user hide records). This can be used to let the Operating System do the login for a program that requires privacy.- Since:
- SuperWaba 4.21
-
keyboardFocusTraversable
public static boolean keyboardFocusTraversable
Defines if the arrow keys will be used to change the focus using the keyboard. Note that some controls will behave differently. It will be true for pen less devices, and it may be changed if your application wants to use navigation keys to change the focus between the controls.- Since:
- SuperWaba 5.5
-
deviceId
public static java.lang.String deviceId
Field that represents a device id that can be used to identify the device's name. For Palm OS devices, see: http://www.mobilegeographics.com/dev/devices.php and http://homepage.mac.com/alvinmok/palm/codenames.html. For Pocket PC devices, it will return the device's name. For Win32 VM, it will return the computer name. For iPod & iPhone devices, values are : "i386" on simulator, "iPod1,1" on iPod Touch, "iPhone1,1" on iPhone, "iPhone1,2" on iPhone 3G, and "iPhone2,1" on iPhone 3GS, as listed in the "Model identifier" row at http://en.wikipedia.org/w/index.php?title=List_of_iPhone_and_iPod_Touch_models&oldid=319641529 If the device can't be identified, it will containnull.
-
vmPath
public static java.lang.String vmPath
The main path used to derivetempPathandappPathand also to store TotalCross global files. This is a read-only property: changing it will have no effect.- Since:
- TotalCross 1.0
-
appPath
public static java.lang.String appPath
The path from where the application is running from. In Palm OS devices, it will be null. This is the default location where the PDBFiles are created. This is a read-only property: changing it will have no effect.- Since:
- SuperWaba 5.81
- See Also:
dataPath
-
NO_BUTTON
public static final int NO_BUTTON
To be used in the closeButtonType. Will remove the x/ok button from screen on Windows CE devices. In Windows 32, the X button will still be visible, but clicking on it will not close the application; instead, the SpcialKeys.MENU key event will be sent to the application.- See Also:
- Constant Field Values
-
CLOSE_BUTTON
public static final int CLOSE_BUTTON
To be used in the closeButtonType. An OK button is placed, and the application is closed when its pressed.- See Also:
- Constant Field Values
-
MINIMIZE_BUTTON
public static final int MINIMIZE_BUTTON
To be used in the closeButtonType. A X button is placed, and the application is minimized when its pressed.- See Also:
- Constant Field Values
-
closeButtonType
public static int closeButtonType
Set it at the application's static initializer. If set to MINIMIZE_BUTTON, replaces the ok button in Windows CE devices, which closes the application, by the x one, which just minimizes the application. The ok closes the application, and the x minimizes it. By default, it is CLOSE_BUTTON, which closes the application.- Since:
- TotalCross 1.11
- See Also:
CLOSE_BUTTON,MINIMIZE_BUTTON,NO_BUTTON
-
isFullScreen
public static boolean isFullScreen
Set it at the application's static initializer. Makes the application full screen. Only a simple assignment to true is supported; you cannot check the platform nor any other attribute of this class because the static initializer is called BEFORE this class have its fields set. Also, some platforms set it at Deploying time. Note that Android applications have problems with the keyboard when its fullscreen.- Since:
- TotalCross 1.0
- See Also:
fullScreenPlatforms
-
fullScreenPlatforms
public static java.lang.String fullScreenPlatforms
Set this to a list of platforms that will set the fullscreen mode. If this member is null, all platforms will have full screen set to the isFullScreen member. Here's a sample, to use full screen on windows devices (but not windows desktop):static { Settings.isFullScreen = true; Settings.fullScreenPlatforms = Settings.WINDOWSCE+","+Settings.WINDOWSMOBILE; }You can use any separator. The only platform that does not work with this is JAVA. You must provide a String like the one above, concatenating the platform Strings in a single line. Using a StringBuffer or anything else may result in incorrect results.- Since:
- TotalCross 1.2
- See Also:
isFullScreen
-
appVersion
public static java.lang.String appVersion
Set it at the application's static initializer. Defines the current application's version, which will be applied to the pdbs. If you turn on automatic build number increment (with appProps) and the appVersion ends with a dot, during deploy the build number will be appended to the appVersion. For example, if appVersion is "2." and the current build number is 103, deploy will change the appVersion to "2.103" during deploy. To see the version that will appear, use at your application's constructo:Settings.appVersion += Settings.appBuildNumber();- Since:
- TotalCross 1.0
-
companyInfo
public static java.lang.String companyInfo
Set it at the application's static initializer; should not contain spaces. Defines the company's information, which is used in iOS and Windows CE. In iOS is used to form the bundle suffix id.- Since:
- TotalCross 1.0
-
companyContact
@Deprecated public static java.lang.String companyContact
Deprecated.Set it at the application's static initializer. Defines the user's or company's contact email, which was used in WP8.- Since:
- TotalCross 1.0
-
appDescription
@Deprecated public static java.lang.String appDescription
Deprecated.Set it at the application's static initializer. Defines the application's description, which was used in WP8.- Since:
- TotalCross 1.0
-
appPackageIdentifier
@Deprecated public static java.lang.String appPackageIdentifier
Deprecated.Set it at the application's static initializer. Defines the application's package identifier, which was used in WP8.
-
appPackagePublisher
@Deprecated public static java.lang.String appPackagePublisher
Deprecated.Set it at the application's static initializer. Defines the application's package publisher, which was used in WP8.
-
iosCFBundleIdentifier
public static java.lang.String iosCFBundleIdentifier
Set it at the application's static initializer. Defines the application's package id, which is used in iOS.
-
appLocation
@Deprecated public static java.lang.String appLocation
Deprecated.No longer used.- Since:
- TotalCross 1.0
-
appCategory
@Deprecated public static java.lang.String appCategory
Deprecated.No longer used.- Since:
- TotalCross 1.0
-
activationServerURI
public static java.lang.String activationServerURI
Set it at the application's static initializer. Specifies a URI to a WebService to be used by the VM activation process.
See the TotalCross Companion for more information about this feature.- Since:
- TotalCross 1.15
-
activationServerNamespace
public static java.lang.String activationServerNamespace
Set it at the application's static initializer. Specifies a namespace for the WebService provided by the user.
See the TotalCross Companion for more information about this feature.- Since:
- TotalCross 1.15
-
showDesktopMessages
public static boolean showDesktopMessages
Set to false to hide all messages that are sent to the console when running at the desktop. Note that doing so may hide important messages! Do it with caution.- Since:
- TotalCross 1.0
-
imei
public static java.lang.String imei
Field that represents the smartphone IMEI (if this device is a GSM, UMTS or IDEN smartphone), or null if there's none.- Since:
- TotalCross 1.0
-
imeis
public static java.lang.String[] imeis
Field that represents the smartphone IMEIs; used in phones with more than one line.- Since:
- TotalCross 1.0
-
esn
public static java.lang.String esn
Field that represents the smartphone ESN (if this device is a CDMA smartphone) or null if there's none.- Since:
- TotalCross 1.0
-
iccid
public static java.lang.String iccid
Field that represents the serial number of the GSM chip or null if there's none. Works for Windows Mobile and Android.- Since:
- TotalCross 1.27
-
dontCloseApplication
@Deprecated public static boolean dontCloseApplication
Deprecated.Not used in any platformIf set to true, the application will ignore the event "Close application" issued by the operating system. This is specially useful to avoid that an incoming call exits the application on Palm OS. You must provide a way to terminate the application by calling the exit method.- Since:
- TotalCross 1.0
- See Also:
MainWindow.exit(int)
-
geographicalFocus
public static boolean geographicalFocus
When directional keys are used to change focus, the next control to receive focus will be determined based on their physical location on the screen. Also, when geographicalFocus is true, the highlight/action key model will not be used. Instead, controls will be highlighted and given focus immediately.
-
multipleInstances
public static boolean multipleInstances
Setting this field to true allows the execution of multiple instances of the same application. When the application is started, it first checks if there is a running instance of the same application. If so, the running instance is moved to the foreground and the starting application exits. This only works for Win32 and WinCE.- Since:
- TotalCross 1.0
-
circularNavigation
public static boolean circularNavigation
Set to false to disable the default circular navigation when using the arrows: it will stop at the first or the last item. It applies to: ListBox, MenuBar, ComboBoxEditable, Grid, MenuBarDropDown.- Since:
- TotalCross 1.13
-
gcCount
public static int gcCount
Number of times that the GC ran. Updated by the VM during the application execution.- Since:
- TotalCross 1.14
-
gcTime
public static int gcTime
How much time the GC took in all runs. Updated by the VM during the application execution.- Since:
- TotalCross 1.14
-
chunksCreated
public static int chunksCreated
Number of memory chunks (blocks of memory that store Objects) created. Updated by the VM during the application execution.- Since:
- TotalCross 1.14
-
lastInteractionTime
public static int lastInteractionTime
Time when the user last interacted with the device using the keyboard, pen, trackball, etc.- Since:
- TotalCross 1.14
-
showMemoryMessagesAtExit
public static boolean showMemoryMessagesAtExit
Set this flag to false (default is true) to don't display the memory errors when the program exits. The possible errors are:- Memory error: out of memory when allocating
- Memory leak: memory was not freed properly
Note that the log messages will still be dumped to the console.- Since:
- TotalCross 1.14
-
showMousePosition
public static boolean showMousePosition
Shows the mouse position in the Window's title when running as Java SE application. This greatly helps the creation of UIRobot's user interface unit tests (using absolute coordinates to simulate the events).- Since:
- TotalCross 1.15
-
deviceRobotSpecialKey
public static int deviceRobotSpecialKey
Makes the generation of user interface tests much easier by using the built-in User Interface Robot.- To enable it at device, you must assign a special key that will open the interface.
- To enable it at desktop (Java SE), you must press control+1.
Vm.interceptSpecialKeys(new int[]{SpecialKeys.FIND}); Settings.deviceRobotSpecialKey = SpecialKeys.FIND;- Since:
- TotalCross 1.3
-
showDebugTimestamp
public static boolean showDebugTimestamp
Set to false to don't display the timestamp before each Vm.debug output.- Since:
- TotalCross 1.15
-
timeZoneStr
public static java.lang.String timeZoneStr
Textual description of the time zone currently used by the device. This value is completely platform dependent, and may be localized for the platform current settings.- Since:
- TotalCross 1.15
-
fingerTouch
public static boolean fingerTouch
Defines platforms that the touchscreen is used MOSTLY with the finger. We say mostly because there are special pens that can be used with iPhone; however, we consider this an exception, not the rule. Currently this value is true for iPhone and Android platforms.
When fingerTouch is true, all controls that can scroll, like ListBox, Grid, ScrollContainer, MultiEdit, etc, will have the flick and drag enabled and the ScrollBar will be replaced by the ScrollPosition.- Since:
- TotalCross 1.2
-
touchTolerance
public static int touchTolerance
Defines a touch tolerance to find the closest control. Used in fingerTouch devices. You can disable it setting this property to 0.- Since:
- TotalCross 1.2
-
fadeOtherWindows
public static boolean fadeOtherWindows
Default fadeOtherWindows value used in the totalcross.ui.dialog windows.- Since:
- TotalCross 1.2
-
enableWindowTransitionEffects
public static boolean enableWindowTransitionEffects
Set to true to enable the transition effects when a window is shown and hidden.- Since:
- TotalCross 1.2
- See Also:
Container.nextTransitionEffect,Container.transitionEffect
-
debugEvents
public static boolean debugEvents
Set to true to debug all events that are received at Window._postEvent.
-
activationId
public static java.lang.String activationId
READ-ONLY unique identifier available for registered applications after the TotalCross VM is activated.
Value defaults to "NOT AVAILABLE" when running on DEMO, and "NO ACTIVATION" when using the new licensing model.- Since:
- TotalCross 1.25
-
vibrateMessageBox
public static boolean vibrateMessageBox
Set to true to enable the vibration when a MessageBox appears on screen (only on device).- Since:
- TotalCross 1.22
-
disableScreenRotation
public static boolean disableScreenRotation
Set to true to disable screen rotation. Works only in JavaSE. If you need this feature on the device, override the screenResized method in your MainWindow and add something like:public void screenResized() { if (Settings.isLandscape()) { // make sure that the MessageBox takes the whole screen MessageBox mb = new MessageBox("Attention","This program must be run in portrait mode.\nPlease rotate the device.",null) { public void setRect(int x, int y, int w, int h) { super.setRect(x,y,Settings.screenWidth,Settings.screenHeight); } }; mb.transitionEffect = TRANSITION_NONE; mb.popupNonBlocking(); while (Settings.isLandscape()) pumpEvents(); mb.unpop(); } else super.screenResized(); }- Since:
- TotalCross 1.27
-
unmovableSIP
public static boolean unmovableSIP
Set to true to move an Edit or MultiEdit to the top of the screen if the application is running in a platform that does not support moving the Soft Input Panel to the top. Otherwise, the SIP (Soft Input Panel) will be placed on top of the Edit. You must set this in the MainWindow's constructor, never in the static block.- Since:
- TotalCross 1.3
- See Also:
SIPBottomLimit,UIColors.shiftScreenColor
-
deviceFontHeight
public static int deviceFontHeight
The size in pixels of the device's system font.
-
moveCursorToEndOnFocus
public static boolean moveCursorToEndOnFocus
Set to true to put the cursor at the end of the Edit and MultiEdit when focus was set to the control (default is at the end).- Since:
- TotalCross 1.3
-
SIPBottomLimit
public static int SIPBottomLimit
The limit that will make the Soft Input Panel be placed at bottom. If the control's absolute rect is < this value, the SIP will stay at the bottom of the screen (otherwise, it will be moved to the top). Before TotalCross 1.3, this value used to be the half of the screen, but since in some new Windows Mobile the SIP is very tall (specially in landscape mode), we added this field so you can change it if desired. For example, to set to 5 times the font's height, do:Settings.SIPBottomLimit = 5 * fmH;
Setting it to -1 (default value) will use half the current screen height. This field is used in Windows CE devices only.- Since:
- TotalCross 1.3
-
uiAdjustmentsBasedOnFontHeight
public static boolean uiAdjustmentsBasedOnFontHeight
Set to true to make the extra adjustment values used in the relative positioning be a percentage of the control's font height. In modern devices, a single pixel can have different sizes in inches (or, in other words, the devices have different screen densities). So, something like PREFERRED+4 in a 320x480 device with 160 DPI (DIPS PER INCH - or pixels per inch) will have the half size of a device with the same resolution but 320 DPI. Since the font sizes change according to the DPI and not the resolution, its good to change the relative positioning to use a percentage of the font's height instead of absolute pixels. By setting this flag to true will make the adjustment a PERCENTAGE of the font's height. So, you can use something like PREFERRED+50 (50% of font's height), SAME+150 (150% of font's height), and so on. It is possible to disable the adjustment for a single Control, Container or Window, using Control.uiAdjustmentsBasedOnFontHeightIsSupported.
-
sendPressEventOnChange
public static boolean sendPressEventOnChange
Set to true to post a PRESSED event when an item is programatically selected or changed. Works with the following controls: Edit, MultiEdit, Check, Radio, ComboBox, ListBox, SpinList. Usually this event only occurs when the user selects an item, not when you call setSelectedItem/Index- Since:
- TotalCross 1.5
-
resizableWindow
public static boolean resizableWindow
Set to true to make the program's window resizable in Windows and desktop.- Since:
- TotalCross 1.53
-
WINDOWSIZE_320X480
public static final int WINDOWSIZE_320X480
Used in the windowSize field.- See Also:
- Constant Field Values
-
WINDOWSIZE_480X640
public static final int WINDOWSIZE_480X640
Used in the windowSize field.- See Also:
- Constant Field Values
-
WINDOWSIZE_600X800
public static final int WINDOWSIZE_600X800
Used in the windowSize field.- See Also:
- Constant Field Values
-
windowSize
public static int windowSize
Defines the window size when running in a desktop computer (the default is 240x320). Must be set in the static initializer. If used, the window will be centered on screen with the given resolution.- Since:
- TotalCross 1.53
- See Also:
WINDOWSIZE_320X480,WINDOWSIZE_480X640,WINDOWSIZE_600X800,resizableWindow
-
WINDOWFONT_12
public static final int WINDOWFONT_12
Used in the windowFont field; sets the size to 12.- See Also:
- Constant Field Values
-
WINDOWFONT_DEFAULT
public static final int WINDOWFONT_DEFAULT
Used in the windowFont field; sets the size to the one defined by user.- See Also:
- Constant Field Values
-
windowFont
@Deprecated public static int windowFont
Deprecated.Use at the application's constructor: if (Settings.platform.equals(Settings.WIN32)) setDefaultFont(Font.getFont(false,NN)); where NN is the desired font sizeDefines the window font size when running in a desktop computer. Must be set in the static initializer.- Since:
- TotalCross 1.53
- See Also:
WINDOWFONT_12,WINDOWFONT_DEFAULT,windowSize,resizableWindow
-
lineNumber
public static java.lang.String lineNumber
Returns the line number of the device. Note that if the phone is off it may return null. It can be null also if the device uses a non-standard API. Works only on Android, since iOS does not allow to get it programatically. For dual-sim devices, returns only the first line number.- Since:
- TotalCross 1.7 / 2.0
-
isOpenGL
public static boolean isOpenGL
Returns true if this is an open gl platform (IOS or Android).- Since:
- TotalCross 1.68
-
optionalBackspaceKey
public static int optionalBackspaceKey
An optional value for the backspace key. Android 4.4.2 has a bug that prevents the backspace from working well; this bug is fixed in 4.4.3. The workaround is to define a unused key that will work as the backspace one. Defaults to the î key, used only if romVersion is 442.
-
optimizeScroll
public static boolean optimizeScroll
Set to false to disable the scroll optimization using images. This optimization greatly improves performance but uses more memory.
-
PALMOS
public static java.lang.String PALMOS
Dumb field to keep compilation compatibility with TC 1
-
BLACKBERRY
public static java.lang.String BLACKBERRY
Dumb field to keep compilation compatibility with TC 1
-
nvfsVolume
public static int nvfsVolume
Dumb field to keep compilation compatibility with TC 1
-
useNewFont
public static boolean useNewFont
Dumb field to keep compilation compatibility with TC 1
-
isMinimized
public static boolean isMinimized
Dumb field to keep compilation compatibility with TC 1
-
keypadOnly
public static boolean keypadOnly
Dumb field to keep compilation compatibility with TC 1
-
scrollDistanceOnMouseWheelMove
public static int scrollDistanceOnMouseWheelMove
Set to 0 to disable the automatic scroll of the ScrollContainer under the mouse position when the mouse wheel changes.
-
bugreportEmail
public static java.lang.String bugreportEmail
An email that will be used to send bug reports when an unhandled exception is caught on your application. Note that you may receive dozens of emails per day. The bug report is sent after an application crash if, and only if, the application is called within 3 minutes after the crash, otherwise, Android may roll out the logs. Note that we always receive a copy of the same message, even if you don't set this email, so we will be aware of the problems. The bug report takes from 5 to 20 seconds to be generated and sent from application's startup time, so if your application crashes too early, the report will halt the exit process until its effectively sent, and a black screen will appear in the meanwhile. You must set this in your application's static initializer, preferrably at the first line. E.G.:static { Settings.bugreportEmail = "bugreports@mycompany.com"; ... }Currently this is supported only on Android.- Since:
- TotalCross 3.1
-
bugreportUser
public static java.lang.String bugreportUser
Set this to the username of your application to be able to filter at the bug report service. IMPORTANT: this must be assigned by your application at the constructor of the application, or it will be ignored in the crash report, because this one is sent very early.- Since:
- TotalCross 3.1
-
activationKey
public static java.lang.String activationKey
The activation key used during deploy
-
pushTokenAndroid
@Deprecated public static java.lang.String pushTokenAndroid
Deprecated.No longer used; put the 'google-services.json' so that the deploy will send it to the app, and it will
-
iosCertDate
public static Time iosCertDate
The due date of the iOS certificate. You can use it to inform your costumers when its time to update the software.
-
abortedOnLastRun
public static boolean abortedOnLastRun
Field set to true if the program have aborted on last run.
-
customKeyboard
public static IVirtualKeyboard customKeyboard
-
enableVirtualKeyboard
public static boolean enableVirtualKeyboard
Set to false to disable the virtual keyboard on all Edits and MultiEdits at once- Since:
- TotalCross 4.0
-
showUIErrors
public static boolean showUIErrors
Set to false to disable UI positional errors that are shown in Java SE
-
ANDROID_ID
public static final java.lang.String ANDROID_ID
On Android it has the value of Settings.Secure.ANDROID_ID. Refer to the Android documentation for more details about this identifier: https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID
-
screenDensity
public static double screenDensity
The logical density of the display, used as a scaling factor for density independent pixels (dp) and scaleable pixels (sp). On WinCE based devices the screen density is set to 0.75 if the largest screen component (width or height) is smaller than 240 pixels. https://material.io/guidelines/layout/units-measurements.htm
-
minimalUpdateInterval
public static final int minimalUpdateInterval
Minimal interval between two Update events- See Also:
- Constant Field Values
-
allowBackup
public static boolean allowBackup
Apps that target Android 6.0 (API level 23) or higher automatically participate in Auto Backup. Set this value to enable or disable backup. The default value is true but to make your intentions clear, we recommend explicitly setting the attribute. You can disable backups by setting allowBackup to false. You might want to do this if your app can recreate its state through some other mechanism or if your app deals with sensitive information that Android shouldn't back up.
-
-
Method Detail
-
appBuildNumber
public static java.lang.String appBuildNumber()
Returns the application's build number. You can make tc.Deploy use this automatically by making the appVersion end with a dot. For example:static { Settings.appVersion = "2.1."; // leading dot } // then at the application's constructor: Settings.appVersion += Settings.appBuildNumber();This way, when you run tc.Deploy, it will update the appVersion to include the build number in all platforms.- Since:
- TotalCross 3.1
- See Also:
appProps
-
isWindowsDevice
public static boolean isWindowsDevice()
Returns true if the current platform is Windows Mobile or Windows Phone. Note that Windows Desktop (aka WIN32) returns false.
-
isWindowsCE
public static boolean isWindowsCE()
Returns true if the current platform is Windows Mobile or Windows Phone. Note that Windows Desktop (aka WIN32) returns false.
-
isIOS
public static boolean isIOS()
Returns true if this is an iPad or an iPhone.- Since:
- TotalCross 1.53
-
refresh
public static void refresh()
Refresh some fields thay may have been updated since the program started. The currently refreshed fields are:- daylightSavings
- timeZone
- timeZoneStr
- Since:
- TotalCross 1.15
-
isLandscape
public static boolean isLandscape()
Returns true if the device is currently in landscale (screenWidth > screenHeight).
-
getUniqueId
public static java.lang.String getUniqueId()
Returns an id from the mobile device (Android and iOS) that should be persistent on reinstall.- Android - Uses UUID with MediaDrm to generate an ID.
- iOS - Retrieves value from UIDevice.identifierForVendor (https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor)
-
getAnimationMaximumFps
public static int getAnimationMaximumFps()
-
-