# Class Display

java.lang.Object
com.codename1.ui.CN1Constants
com.codename1.ui.Display

public final class Display extends CN1Constants

Central class for the API that manages rendering/events and is used to place top level components (`Form`) on the "display".

This class handles the main thread for the toolkit referenced here on as the EDT (Event Dispatch Thread) similar to the Swing EDT. This thread encapsulates the platform specific event delivery and painting semantics and enables threading features such as animations etc...

The EDT should not be blocked since paint operations and events would also be blocked in much the same way as they would be in other platforms. To serialize calls back into the EDT, use the methods `Display#callSerially` & `Display#callSeriallyAndWait`.

Notice that all Codename One calls occur on the EDT (events, painting, animations, etc...), Codename One should normally be manipulated on the EDT as well (hence the `Display#callSerially` & `Display#callSeriallyAndWait` methods). Theoretically, it should be possible to manipulate some Codename One features from other threads, but this can't be guaranteed to work for all use cases.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `COMMAND_BEHAVIOR_BUTTON_BAR`
  Indicates that commands should be added to an always visible bar at the bottom of the form.
  `static final int`
  `COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_BACK`
  Identical to the bar behavior, places the back command within the title bar of the form/dialg
  `static final int`
  `COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_RIGHT`
  Places all commands on the right side of the title bar with a uniform size grid layout
  `static final int`
  `COMMAND_BEHAVIOR_DEFAULT`
  Indicates that the Codename One implementation should decide internally the command behavior most appropriate for this platform.
  `static final int`
  `COMMAND_BEHAVIOR_ICS`
  Commands are placed in the same was as they are in the ice cream sandwich Android OS update where the back button has a theme icon the application icon appears next to the
  `static final int`
  `COMMAND_BEHAVIOR_NATIVE`
  Indicates that commands should try to add themselves to the native menus
  `static final int`
  `COMMAND_BEHAVIOR_SIDE_NAVIGATION`
  Commands are placed in a side menu similar to Facebook/Google+ apps
  `static final int`
  `COMMAND_BEHAVIOR_SOFTKEY`
  Indicates the classic Codename One command behavior where the commands are placed in a list within a dialog.
  `static final int`
  `COMMAND_BEHAVIOR_TOUCH_MENU`
  Indicates the touch menu dialog rendered by Codename One where commands are placed into a scrollable dialog
  `static final int`
  `GAME_DOWN`
  Game action for down key
  `static final int`
  `GAME_FIRE`
  Game action for fire
  `static final int`
  `GAME_LEFT`
  Game action for the left key
  `static final int`
  `GAME_RIGHT`
  Game action for right key
  `static final int`
  `GAME_UP`
  Game action for UP key
  `static final int`
  `KEY_POUND`
  An attribute that encapsulates '#' int value.
  `static final int`
  `KEYBOARD_TYPE_HALF_QWERTY`
  Half-QWERTY which needs software assistance for completion
  `static final int`
  `KEYBOARD_TYPE_NUMERIC`
  Numeric keypad keyboard type
  `static final int`
  `KEYBOARD_TYPE_QWERTY`
  Full QWERTY keypad keyboard type, even if a numeric keyboard also exists
  `static final int`
  `KEYBOARD_TYPE_UNKNOWN`
  Unknown keyboard type is the default indicating the software should try to detect the keyboard type if necessary
  `static final int`
  `KEYBOARD_TYPE_VIRTUAL`
  A touch based device that doesn't have a physical keyboard.
  `static final int`
  `MEDIA_KEY_FAST_BACKWARD`
  Special case game key used for media playback events
  `static final int`
  `MEDIA_KEY_FAST_FORWARD`
  Special case game key used for media playback events
  `static final int`
  `MEDIA_KEY_PLAY`
  Special case game key used for media playback events
  `static final int`
  `MEDIA_KEY_PLAY_PAUSE`
  Special case game key used for media playback events
  `static final int`
  `MEDIA_KEY_PLAY_STOP`
  Special case game key used for media playback events
  `static final int`
  `MEDIA_KEY_SKIP_BACK`
  Special case game key used for media playback events
  `static final int`
  `MEDIA_KEY_SKIP_FORWARD`
  Special case game key used for media playback events
  `static final int`
  `MEDIA_KEY_STOP`
  Special case game key used for media playback events
  `static final int`
  `SHOW_DURING_EDIT_ALLOW_DISCARD`
  Allow show to occur during edit and discard all user input at this moment
  `static final int`
  `SHOW_DURING_EDIT_ALLOW_SAVE`
  Allow show to occur during edit and save all user input at this moment
  `static final int`
  `SHOW_DURING_EDIT_EXCEPTION`
  If show is called while editing text in the native text box an exception is thrown
  `static final int`
  `SHOW_DURING_EDIT_IGNORE`
  Ignore all calls to show occurring during edit, they are discarded immediately
  `static final int`
  `SHOW_DURING_EDIT_SET_AS_NEXT`
  Show will update the current form to which the OK button of the text box will return
  `static final String`
  `SOUND_TYPE_ALARM`
  A common sound type that can be used with playBuiltinSound
  `static final String`
  `SOUND_TYPE_BUTTON_PRESS`
  A common sound type that can be used with playBuiltinSound
  `static final String`
  `SOUND_TYPE_CONFIRMATION`
  A common sound type that can be used with playBuiltinSound
  `static final String`
  `SOUND_TYPE_ERROR`
  A common sound type that can be used with playBuiltinSound
  `static final String`
  `SOUND_TYPE_INFO`
  A common sound type that can be used with playBuiltinSound
  `static final String`
  `SOUND_TYPE_WARNING`
  A common sound type that can be used with playBuiltinSound
  `static final String`
  `WINDOW_SIZE_HINT_PERCENT`
  Client property key used on the first shown `Form` to indicate the desired initial window size as a percentage of the available desktop.

  ### Fields inherited from class CN1Constants

  `DENSITY_2HD, DENSITY_4K, DENSITY_560, DENSITY_HD, DENSITY_HIGH, DENSITY_LOW, DENSITY_MEDIUM, DENSITY_VERY_HIGH, DENSITY_VERY_LOW, GALLERY_ALL, GALLERY_ALL_MULTI, GALLERY_IMAGE, GALLERY_IMAGE_MULTI, GALLERY_VIDEO, GALLERY_VIDEO_MULTI, PICKER_TYPE_CALENDAR, PICKER_TYPE_DATE, PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_DURATION, PICKER_TYPE_DURATION_HOURS, PICKER_TYPE_DURATION_MINUTES, PICKER_TYPE_STRINGS, PICKER_TYPE_TIME, SMS_BOTH, SMS_INTERACTIVE, SMS_NOT_SUPPORTED, SMS_SEAMLESS`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addCompletionHandler(Media media, Runnable onCompletion)`
  Adds a callback to a Media element that will be called when the media finishes playing.
  `void`
  `addEdtErrorHandler(ActionListener e)`
  An error handler will receive an action event with the source exception from the EDT once an error handler is installed the default Codename One error dialog will no longer appear
  `void`
  `addMessageListener(ActionListener<MessageEvent> l)`
  Adds a listener to receive messages from the native platform.
  `void`
  `addVirtualKeyboardListener(ActionListener l)`
  Adds a listener for VirtualKeyboard hide/show events.
  `void`
  `addWindowListener(ActionListener<WindowEvent> l)`
  Adds a listener to receive notifications about native window changes such as resize or movement.
  `void`
  `announceForAccessibility(Component cmp, String text)`
  Manually announces text to native accessibility services, optionally associating the announcement with a specific component.
  `void`
  `announceForAccessibility(String text)`
  Convenience overload to announce text without specifying a component.
  `boolean`
  `areMutableImagesFast()`
  On most platforms it is quite fast to draw on a mutable image and then render that image, however some platforms have much slower mutable images in comparison to just drawing on the screen.
  `void`
  `callSerially(Runnable r)`
  Causes the runnable to be invoked on the event dispatch thread.
  `void`
  `callSeriallyAndWait(Runnable r)`
  Identical to callSerially with the added benefit of waiting for the Runnable method to complete.
  `void`
  `callSeriallyAndWait(Runnable r, int timeout)`
  Identical to callSerially with the added benefit of waiting for the Runnable method to complete.
  `void`
  `callSeriallyOnIdle(Runnable r)`
  Causes the runnable to be invoked on the event dispatch thread when the event dispatch thread is idle.
  `void`
  `cancelBackgroundProcessing(String id)`
  Cancels a scheduled background processing task.
  `void`
  `cancelBackgroundWork(String workId)`
  Cancels scheduled background work by id.
  `void`
  `cancelLocalNotification(String notificationId)`
  Cancels a local notification by ID.
  `boolean`
  `canDial()`
  Returns true if the device has dialing capabilities
  `Boolean`
  `canExecute(String url)`
  Returns true if executing this URL should work, returns false if it will not and null if this is unknown.
  `boolean`
  `canForceOrientation()`
  Returns true if the device allows forcing the orientation via code, feature phones do not allow this although some include a jad property allowing for this feature
  `boolean`
  `canInstallOnHomescreen()`
  Checks to see if you can prompt the user to install the app on their homescreen.
  `void`
  `captureAudio(MediaRecorderBuilder recordingOptions, ActionListener response)`
  This method tries to invoke the device native hardware to capture audio.
  `void`
  `captureAudio(ActionListener<ActionEvent> response)`
  This method tries to invoke the device native hardware to capture audio.
  `void`
  `capturePhoto(ActionListener response)`
  This method tries to invoke the device native camera to capture images.
  `Image`
  `captureScreen()`
  Captures a screenshot of the screen.
  `void`
  `captureVideo(VideoCaptureConstraints constraints, ActionListener response)`
  Same as `#captureVideo(com.codename1.ui.events.ActionListener)`, except that it attempts to impose constraints on the capture.
  `void`
  `captureVideo(ActionListener response)`
  This method tries to invoke the device native camera to capture video.
  `String`
  `convertBidiLogicalToVisual(String s)`
  Converts the given string from logical bidi layout to visual bidi layout so it can be rendered properly on the screen.
  `int`
  `convertToPixels(float dipCount)`
  Converts the dips count to pixels, dips are roughly 1mm in length.
  `int`
  `convertToPixels(float value, byte unitType)`
  Converts from specified unit to pixels.
  `int`
  `convertToPixels(float value, byte unitType, boolean horizontal)`
  Converts from specified unit to pixels.
  `int`
  `convertToPixels(int dipCount, boolean horizontal)`
  Converts the dips count to pixels, dips are roughly 1mm in length.
  `void`
  `copyToClipboard(Object obj)`
  Performs a clipboard copy operation, if the native clipboard is supported by the implementation it would be used
  `Media`
  `createBackgroundMedia(String uri)`
  Creates an audio media that can be played in the background.
  `AsyncResource<Media>`
  `createBackgroundMediaAsync(String uri)`
  Creates an audio media that can be played in the background.
  `String`
  `createContact(String firstName, String familyName, String officePhone, String homePhone, String cellPhone, String email)`
  Create a contact to the device contacts book
  `Media`
  `createMedia(InputStream stream, String mimeType, Runnable onCompletion)`
  Create the sound in the given stream Notice that an audio is "auto destroyed" on completion and cannot be played twice!
  `Media`
  `createMedia(String uri, boolean isVideo, Runnable onCompletion)`
  Creates a sound in the given URI which is partially platform specific.
  `AsyncResource<Media>`
  `createMediaAsync(InputStream stream, String mimeType, Runnable onCompletion)`
  `AsyncResource<Media>`
  `createMediaAsync(String uri, boolean video, Runnable onCompletion)`
  Creates media asynchronously.
  `Media`
  `createMediaRecorder(MediaRecorderBuilder builder)`

  ###### Parameters

  `Media`
  `createMediaRecorder(String path)`
  Creates a Media recorder Object which will record from the device mic to a file in the given path.
  `Media`
  `createMediaRecorder(String path, String mimeType)`
  Creates a Media recorder Object which will record from the device mic to a file in the given path.
  `void`
  `createNotificationChannelGroup(String groupId, String groupName)`
  Creates a notification channel group (Android).
  `Object`
  `createSoftWeakRef(Object o)`
  Creates a soft/weak reference to an object that allows it to be collected yet caches it.
  `Thread`
  `createThread(Runnable r, String name)`
  Start a Codename One thread that supports crash protection and similar Codename One features.
  `static void`
  `deinitialize()`
  Closes down the EDT and Codename One, under normal conditions this method is completely unnecessary since exiting the application will shut down Codename One.
  `void`
  `delete(String databaseName)`
  Deletes database
  `boolean`
  `deleteContact(String id)`
  removed a contact from the device contacts book
  `void`
  `deleteNotificationChannel(String channelId)`
  Deletes a notification channel (Android).
  `void`
  `deregisterPush()`
  Stop receiving push notifications to this client application
  `void`
  `dial(String phoneNumber)`
  Opens the device Dialer application with the given phone number
  `void`
  `dismissNotification(Object o)`
  Removes the notification previously posted with the notify status bar method
  `void`
  `dispatchMessage(MessageEvent evt)`
  Dispatches a message to all of the registered listeners.
  `void`
  `editString(Component cmp, int maxSize, int constraint, String text)`
  Fires the native in place text editing logic, normally you wouldn't invoke this API directly and instead use an API like `com.codename1.ui.TextArea#startEditingAsync()`, `com.codename1.ui.TextArea#startEditing()` or `com.codename1.ui.Form#setEditOnShow(com.codename1.ui.TextArea)`.
  `void`
  `editString(Component cmp, int maxSize, int constraint, String text, int initiatingKeycode)`
  Fires the native in place text editing logic, normally you wouldn't invoke this API directly and instead use an API like `com.codename1.ui.TextArea#startEditingAsync()`, `com.codename1.ui.TextArea#startEditing()` or `com.codename1.ui.Form#setEditOnShow(com.codename1.ui.TextArea)`.
  `void`
  `execute(String url)`
  Executes the given URL on the native platform.
  `void`
  `execute(String url, ActionListener response)`
  Executes the given URL on the native platform, this method is useful if the platform has the ability to send an event to the app when the execution has ended, currently this works only for Android platform to invoke other intents.
  `boolean`
  `exists(String databaseName)`
  Indicates weather a database exists
  `void`
  `exitApplication()`
  Exits the application...
  `boolean`
  `exitFullScreen()`
  Try to exit full-screen mode if the platform supports it.
  `Object`
  `extractHardRef(Object o)`
  Extracts the hard reference from the soft/weak reference given
  `void`
  `fireVirtualKeyboardEvent(boolean show)`
  Fires a virtual keyboard show event.
  `void`
  `fireWindowEvent(WindowEvent evt)`
  Dispatches a window change event to registered listeners.
  `void`
  `flashBacklight(int duration)`
  Flash the backlight of the device for the given length of time
  `Image`
  `gaussianBlurImage(Image image, float radius)`
  Create a blur image from the given image.
  `String[]`
  `getAllContacts(boolean withNumbers)`
  Gets all contacts from the address book of the device
  `Contact[]`
  `getAllContacts(boolean withNumbers, boolean includesFullName, boolean includesPicture, boolean includesNumbers, boolean includesEmail, boolean includeAddress)`
  Notice: this method might be very slow and should be invoked on a separate thread! It might have platform specific optimizations over getAllContacts followed by looping over individual contacts but that isn't guaranteed.
  `String[]`
  `getAvailableRecordingMimeTypes()`
  Gets the available recording MimeTypes
  `Biometrics`
  `getBiometrics()`
  Returns the platform biometric authentication entry point.
  `BonjourPlatform`
  `getBonjourPlatform()`
  Returns the platform's Bonjour / mDNS implementation.
  `int`
  `getCharLocation(String source, int index)`
  Returns the index of the given char within the source string, the actual index isn't necessarily the same when bidi is involved See this for more on visual vs.
  `CodeScanner`
  `getCodeScanner()`
  Returns the native implementation of the code scanner or null
  `int`
  `getCommandBehavior()`
  Indicates the way commands should be added to a form as one of the ocmmand constants defined in this class
  `Contact`
  `getContactById(String id)`
  Get a Contact according to it's contact id.
  `Contact`
  `getContactById(String id, boolean includesFullName, boolean includesPicture, boolean includesNumbers, boolean includesEmail, boolean includeAddress)`
  This method returns a Contact by the contact id and fills it's data according to the given flags.
  `CrashReport`
  `getCrashReporter()`
  The crash reporter gets invoked when an uncaught exception is intercepted
  `Form`
  `getCurrent()`
  Return the form currently displayed on the screen or null if no form is currently displayed.
  `String`
  `getDatabasePath(String databaseName)`
  Returns the file path of the Database if support for database exists on the platform.
  `VirtualKeyboardInterface`
  `getDefaultVirtualKeyboard()`
  Get the default virtual keyboard or null if the VirtualKeyboard is disabled
  `String`
  `getDensityStr()`
  Returns the device density as a string.
  `Dimension`
  `getDesktopSize()`
  Returns the size of the desktop hosting the application window when running on a desktop platform.
  `int`
  `getDeviceDensity()`
  Returns one of the density variables appropriate for this device, notice that density doesn't always correspond to resolution and an implementation might decide to change the density based on DPI constraints.
  `int`
  `getDisplayHeight()`
  Return the height of the display
  `Rectangle`
  `getDisplaySafeArea(Rectangle rect)`
  Gets the display safe area as a rectangle.
  `int`
  `getDisplayWidth()`
  Return the width of the display
  `float`
  `getDragSpeed(boolean yAxis)`
  This method returns the dragging speed based on the latest dragged events
  `int`
  `getDragStartPercentage()`
  This method allows us to manipulate the drag started detection logic.
  `int`
  `getFrameRate()`
  Indicates the maximum frames the API will try to draw every second
  `int`
  `getGameAction(int keyCode)`
  Returns the game action code matching the given key combination
  `ImageIO`
  `getImageIO()`
  Returns the image IO instance that allows scaling image files.
  `Purchase`
  `getInAppPurchase()`
  Returns the native OS purchase implementation if applicable, if unavailable this method will try to fallback to a custom purchase implementation and failing that will return null
  `Purchase`
  `getInAppPurchase(boolean d)`

  ###### Deprecated

  `Dimension`
  `getInitialWindowSizeHintPercent()`
  Returns the initial desktop window size hint provided by the first shown form, when available.
  `static Display`
  `getInstance()`
  Return the Display instance
  `int`
  `getInvisibleAreaUnderVKB()`
  Gets the invisible area under the Virtual Keyboard.
  `int`
  `getKeyboardType()`
  Returns the type of the input device one of: KEYBOARD_TYPE_UNKNOWN, KEYBOARD_TYPE_NUMERIC, KEYBOARD_TYPE_QWERTY, KEYBOARD_TYPE_VIRTUAL, KEYBOARD_TYPE_HALF_QWERTY
  `int`
  `getKeyCode(int gameAction)`
  Returns the keycode matching the given game action constant (the opposite of getGameAction).
  `float`
  `getLargerTextScale()`
  Returns a scale factor representing how much larger system fonts should be.
  `String`
  `getLineSeparator()`
  `String[]`
  `getLinkedContactIds(Contact c)`
  Gets IDs of all contacts that are linked to a given contact.
  `L10NManager`
  `getLocalizationManager()`
  The localization manager allows adapting values for display in different locales thru parsing and formatting capabilities (similar to JavaSE's DateFormat/NumberFormat).
  `LocationManager`
  `getLocationManager()`
  This method returns the platform Location Manager used for geofencing.
  `int`
  `getLongPointerPressInterval()`
  Long pointer press is invoked after the given interval, this allows making long press events shorter/longer
  `String`
  `getMediaRecorderingMimeType()`
  Gets the recording mime type for the returned Media from the createMediaRecorder method
  `String`
  `getMsisdn()`
  Returns the MSISDN for devices that expose it
  `NetworkTypePlatform`
  `getNetworkTypePlatform()`
  Returns the platform's network-type tracker used by `NetworkManager.addNetworkTypeListener(...)`.
  `Nfc`
  `getNfc()`
  Returns the platform NFC entry point.
  `Object`
  `getPasteDataFromClipboard()`
  Returns the current content of the clipboard
  `String`
  `getPlatformName()`
  Returns a 2-3 letter code representing the platform name for the platform override
  `String[]`
  `getPlatformOverrides()`
  Returns the suffixes for ovr files that should be used when loading a layered resource file on this platform
  `PluginSupport`
  `getPluginSupport()`
  Gets reference to plugin support object.
  `int`
  `getPreferredBackgroundFetchInterval(int seconds)`
  Gets the preferred time (in seconds) between background fetches.
  `Map<String,String>`
  `getProjectBuildHints()`
  Returns the build hints for the simulator, this will only work in the debug environment and it's designed to allow extensions/API's to verify user settings/build hints exist
  `String`
  `getProperty(String key, String defaultValue)`
  Returns the property from the underlying platform deployment or the default value if no deployment values are supported.
  `InputStream`
  `getResourceAsStream(Class cls, String resource)`
  This method is essentially equivalent to cls.getResourceAsStream(String) however some platforms might define unique ways in which to load resources within the implementation.
  `SecureStorage`
  `getSecureStorage()`
  Returns the platform biometric-gated secure storage.
  `BrowserComponent`
  `getSharedJavascriptContext()`
  Gets a reference to an application-wide shared Javascript context that can be used for running Javascript commands.
  `int`
  `getShowDuringEditBehavior()`
  Returns the status of the show during edit flag
  `Simd`
  `getSimd()`
  Returns the SIMD API instance bound to the current implementation.
  `int`
  `getSMSSupport()`
  Indicates the level of SMS support in the platform as one of: `#SMS_NOT_SUPPORTED` (for desktop, tablet etc.), `#SMS_SEAMLESS` (no UI interaction), `#SMS_INTERACTIVE` (with compose UI), `#SMS_BOTH`.
  `String`
  `getStackTrace(Thread parentThread, Throwable t)`
  Returns the stack trace from the exception on the given thread.
  `String[]`
  `getSupportedVirtualKeyboard()`
  Returns all platform supported virtual keyboards names
  `String`
  `getUdid()`
  Returns the UDID for devices that support it
  `UsbPlatform`
  `getUsbPlatform()`
  Returns the platform's USB host implementation.
  `ActionListener`
  `getVirtualKeyboardListener()`
  Gets the VirtualKeyboardListener Objects of exists.
  `WifiDirectPlatform`
  `getWifiDirectPlatform()`
  Returns the platform's WiFi-Direct implementation.
  `WifiPlatform`
  `getWifiPlatform()`
  Returns the platform's WiFi implementation.
  `Rectangle`
  `getWindowBounds()`
  Returns the current window bounds when running on a desktop platform.
  `boolean`
  `hasCamera()`
  Returns true if the device has camera false otherwise.
  `boolean`
  `hasDragOccured()`
  This method should be invoked by components that broadcast events on the pointerReleased callback.
  `boolean`
  `hasNativeTheme()`
  Indicates if the implemenetation has a native underlying theme
  `void`
  `hideNotify()`
  Broadcasts hide notify into Codename One, this method is invoked by the Codename One implementation to notify Codename One of hideNotify events
  `static void`
  `init(Object m)`
  This is the INTERNAL Display initialization method, it will be removed in future versions of the API.
  `void`
  `installBuiltinSound(String soundIdentifier, InputStream data)`
  Installs a replacement sound as the builtin sound responsible for the given sound identifier (this will override the system sound if such a sound exists).
  `void`
  `installNativeTheme()`
  Installs the native theme, this is only applicable if hasNativeTheme() returned true.
  `void`
  `invokeAndBlock(Runnable r)`
  Invokes runnable and blocks the current thread, if the current thread is the EDT it will still be blocked in a way that doesn't break event dispatch .
  `void`
  `invokeAndBlock(Runnable r, boolean dropEvents)`
  Invokes runnable and blocks the current thread, if the current thread is the EDT it will still be blocked in a way that doesn't break event dispatch .
  `void`
  `invokeWithoutBlocking(Runnable r)`
  Invokes a Runnable with blocking disabled.
  `<T> T`
  `invokeWithoutBlockingWithResultSync(RunnableWithResultSync<T> r)`
  Invokes a RunnableWithResultSync with blocking disabled.
  `boolean`
  `isAllowMinimizing()`
  Allows a Codename One application to minimize without forcing it to the front whenever a new dialog is poped up
  `boolean`
  `isAltGraphKeyDown()`
  Checks if the altgraph key is currently down.
  `boolean`
  `isAltKeyDown()`
  Checks if the alt key is currently down.
  `boolean`
  `isAutoFoldVKBOnFormSwitch()`
  Normally Codename One folds the VKB when switching forms this field allows us to block that behavior.
  `boolean`
  `isBackgroundFetchSupported()`
  Checks to see if the current platform supports background fetch.
  `boolean`
  `isBackgroundProcessingSupported()`
  Returns true if deferrable background processing is supported.
  `boolean`
  `isBackgroundWorkSupported()`
  Returns true if constraint-aware background work is supported.
  `boolean`
  `isBadgingSupported()`
  Returns true if the underlying OS supports numeric badges on icons.
  `boolean`
  `isBidiAlgorithm()`
  Indicates whether Codename One should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.
  `boolean`
  `isBuiltinSoundAvailable(String soundIdentifier)`
  Indicates whether a user installed or system sound is available
  `boolean`
  `isBuiltinSoundsEnabled()`
  Allows muting/unmuting the builtin sounds easily
  `boolean`
  `isCallDetectionSupported()`
  Indicates whether this platform can attempt to detect active phone-call interruptions.
  `boolean`
  `isClickTouchScreen()`
  Indicates whether the device has a double layer screen thus allowing two stages to touch events: click and hover.
  `boolean`
  `isContactsPermissionGranted()`
  Some platforms allow the user to block contacts access on a per application basis this method returns true if the user denied permission to access contacts.
  `boolean`
  `isControlKeyDown()`
  Checks if the control key is currently down.
  `Boolean`
  `isDarkMode()`
  Returns true if the platform is in dark mode, null is returned for unknown status
  `boolean`
  `isDatabaseCustomPathSupported()`
  `boolean`
  `isDesktop()`
  Returns true if this is a desktop application
  `boolean`
  `isEdt()`
  Returns true if we are currently in the event dispatch thread.
  `boolean`
  `isEnableAsyncStackTraces()`
  Checks if async stack traces are enabled.
  `boolean`
  `isForegroundServiceSupported()`
  Returns true if foreground services are supported.
  `boolean`
  `isFullScreenSupported()`
  Checks if this platform supports full-screen mode.
  `boolean`
  `isGalleryTypeSupported(int type)`
  Checks to see if the given gallery type is supported on the current platform.
  `boolean`
  `isGaussianBlurSupported()`
  Returns true if gaussian blur is supported on this platform
  `boolean`
  `isGetAllContactsFast()`
  Indicates if the getAllContacts is platform optimized, notice that the method might still take seconds or more to run so you should still use a separate thread!
  `boolean`
  `isInCall()`
  Best-effort check for whether the platform currently believes an active phone call is interrupting the app.
  `boolean`
  `isInFullScreenMode()`
  Checks if the app is currently running in full-screen mode.
  `static boolean`
  `isInitialized()`
  This method returns true if the Display is initialized.
  `boolean`
  `isInTransition()`
  Returns true if the system is currently in the process of transitioning between forms
  `boolean`
  `isJailbrokenDevice()`
  Returns true if this device is jailbroken or rooted, false if not or unknown.
  `boolean`
  `isLargerTextEnabled()`
  Returns true if the user has selected larger type fonts in the system settings.
  `boolean`
  `isLockOrientation()`
  Returns true if orientation was locked using #lockOrientation(boolean) and not yet unlocked via #unlockOrientation().
  `boolean`
  `isMetaKeyDown()`
  Checks if the meta key is currently down.
  `boolean`
  `isMinimized()`
  Indicates whether an application is minimized
  `boolean`
  `isMultiKeyMode()`
  When set to true Codename One allows multiple hardware keys to be pressed at once, this isn't on by default since it can trigger some complexities with UI navigation to/from native code
  `boolean`
  `isMultiTouch()`
  Indicates whether the device supports multi-touch events, this is only relevant when touch events are supported
  `boolean`
  `isNativeCommands()`
  Indicates whether Codename One commands should be mapped to the native menus
  `boolean`
  `isNativeInputSupported()`
  Indicates whether the device supports native in place editing in which case lightweight input logic shouldn't be used for input.
  `boolean`
  `isNativePickerTypeSupported(int pickerType)`
  Indicates whether the native picker dialog is supported for the given type which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATE
  `boolean`
  `isNativeShareSupported()`
  Indicates if the underlying platform supports sharing capabilities
  `boolean`
  `isNativeTitle()`
  Indicates if the title of the Form is native title(in android ICS devices if the command behavior is native the ActionBar is used to display the title and the menu)
  `boolean`
  `isNativeVideoPlayerControlsIncluded()`
  Indicates if the native video player includes its own play/pause etc.
  `boolean`
  `isNotificationSupported()`
  Indicates whether the notify status bar method will present a notification to the user
  `boolean`
  `isOpenNativeNavigationAppSupported()`
  Returns true if the underlying OS supports opening the native navigation application
  `boolean`
  `isPortrait()`
  Returns true if the device is currently in portrait mode
  `boolean`
  `isPureTouch()`
  A pure touch device has no focus showing when the user is using the touch interface.
  `boolean`
  `isReceiveSharedContentSupported()`
  Returns true if the platform can receive shared content from other apps.
  `boolean`
  `isRightMouseButtonDown()`
  Checks if the last mouse press was a right click.
  `boolean`
  `isRTL(char c)`
  Returns true if the given character is an RTL character
  `boolean`
  `isScreenSaverDisableSupported()`
  Checks if the device supports disabling the screen display from dimming, allowing the developer to keep the screen display on.
  `boolean`
  `isScrollWheeling()`
  Checks is the scroll-wheel mouse is currently scrolling.
  `boolean`
  `isShiftKeyDown()`
  Checks if shift key is currently down.
  `boolean`
  `isSimulator()`
  Allows detecting development mode so debugging code and special cases can be used to simplify flow
  `boolean`
  `isSpeechRecognitionSupported()`
  Whether `SpeechRecognizer` is implemented on the current platform.
  `boolean`
  `isTablet()`
  Indicates whether the device is a tablet, notice that this is often a guess
  `boolean`
  `isTextToSpeechSupported()`
  Whether `TextToSpeech` is implemented on the current platform.
  `boolean`
  `isThirdSoftButton()`
  Indicates whether the 3rd softbutton should be supported on this device
  `boolean`
  `isTouchScreenDevice()`
  The name of this method is misleading due to it's legacy.
  `boolean`
  `isVirtualKeyboardShowing()`
  Indicates if the virtual keyboard is currently showing or not
  `void`
  `keyPressed(int keyCode)`
  Pushes a key press event with the given keycode into Codename One
  `void`
  `keyReleased(int keyCode)`
  Pushes a key release event with the given keycode into Codename One
  `void`
  `lockOrientation(boolean portrait)`
  On devices that return true for canForceOrientation() this method can lock the device orientation either to portrait or landscape mode
  `boolean`
  `minimizeApplication()`
  Minimizes the current application if minimization is supported by the platform (may fail).
  `void`
  `notifyPushCompletion()`
  Notifies the platform that push notification processing is complete.
  `void`
  `notifyStatusBar(String tickerText, String contentTitle, String contentBody, boolean vibrate, boolean flashLights)`
  Place a notification on the device status bar (if device has this functionality).
  `Object`
  `notifyStatusBar(String tickerText, String contentTitle, String contentBody, boolean vibrate, boolean flashLights, Hashtable args)`
  Place a notification on the device status bar (if device has this functionality).
  `int`
  `numAlphaLevels()`
  Return the number of alpha levels supported by the implementation.
  `int`
  `numColors()`
  Returns the number of colors applicable on the device, note that the API does not support gray scale devices.
  `void`
  `onCanInstallOnHomescreen(Runnable r)`
  A callback fired when you are allowed to prompt the user to install the app on their homescreen.
  `void`
  `onEditingComplete(Component c, String text)`
  Called by the underlying implementation to indicate that editing in the native system has completed and changes should propagate into Codename One
  `void`
  `openGallery(ActionListener response, int type)`
  Opens the device gallery to pick an image or a video.
  `void`
  `openImageGallery(ActionListener response)`
  Opens the device image gallery The method returns immediately and the response will be sent asynchronously to the given ActionListener Object
  `void`
  `openNativeNavigationApp(double latitude, double longitude)`
  Opens the native navigation app in the given coordinate.
  `void`
  `openNativeNavigationApp(String location)`
  Opens the native navigation app with the given search location
  `Database`
  `openOrCreate(String databaseName)`
  Opens a database or create one if not exists.
  `boolean`
  `platformUsesInputMode()`
  Checks if this platform uses input modes.
  `void`
  `playBuiltinSound(String soundIdentifier)`
  Plays a builtin device sound matching the given identifier, implementations and themes can offer additional identifiers to the ones that are already built in.
  `void`
  `pointerDragged(int[] x, int[] y)`
  Pushes a pointer drag event with the given coordinates into Codename One
  `void`
  `pointerHover(int[] x, int[] y)`
  Pushes a pointer hover event with the given coordinates into Codename One
  `void`
  `pointerHoverPressed(int[] x, int[] y)`
  Pushes a pointer hover release event with the given coordinates into Codename One
  `void`
  `pointerHoverReleased(int[] x, int[] y)`
  Pushes a pointer hover release event with the given coordinates into Codename One
  `void`
  `pointerPressed(int[] x, int[] y)`
  Pushes a pointer press event with the given coordinates into Codename One
  `void`
  `pointerReleased(int[] x, int[] y)`
  Pushes a pointer release event with the given coordinates into Codename One
  `void`
  `postMessage(MessageEvent message)`
  Posts a message to the native platform.
  `boolean`
  `promptInstallOnHomescreen()`
  Prompts the user to install this app on their homescreen.
  `void`
  `refreshContacts()`
  Refreshes the native list of contacts on devices that require this see `com.codename1.contacts.ContactsManager#refresh()`
  `void`
  `refreshNativeTitle()`
  if the title is native(e.g the android action bar), notify the native title that is needs to be refreshed
  `void`
  `registerNotificationChannel(NotificationChannelBuilder builder)`
  Registers a notification channel (Android).
  `void`
  `registerPush()`
  Register to receive push notification, invoke this method once (ever) to receive push notifications.
  `void`
  `registerPush(String id, boolean noFallback)`
  User register to receive push notification
  `void`
  `registerPush(Hashtable metaData, boolean noFallback)`
  Register to receive push notification, invoke this method once (ever) to receive push notifications.
  `void`
  `registerVirtualKeyboard(VirtualKeyboardInterface vkb)`
  Register a virtual keyboard
  `void`
  `removeCompletionHandler(Media media, Runnable onCompletion)`
  Removes onComplete callback from Media element.
  `void`
  `removeEdtErrorHandler(ActionListener e)`
  An error handler will receive an action event with the source exception from the EDT once an error handler is installed the default Codename One error dialog will no longer appear
  `void`
  `removeMessageListener(ActionListener<MessageEvent> l)`
  Removes a listener from receiving messages from the native platform.
  `void`
  `removeVirtualKeyboardListener(ActionListener l)`
  Removes a listener for VirtualKeyboard hide/show events.
  `void`
  `removeWindowListener(ActionListener<WindowEvent> l)`
  Removes a previously registered window listener.
  `boolean`
  `requestFullScreen()`
  Try to enter full-screen mode if the platform supports it.
  `void`
  `requestNotificationPermission(NotificationPermissionCallback callback)`
  Requests permission to post notifications using a default request (alert, sound and badge).
  `void`
  `requestNotificationPermission(NotificationPermissionRequest request, NotificationPermissionCallback callback)`
  Requests permission to post notifications with the capabilities described by the given request.
  `void`
  `restoreMinimizedApplication()`
  Restore the minimized application if minimization is supported by the platform
  `void`
  `restoreToBookmark()`
  Runs the last bookmark that was set using `#setBookmark(java.lang.Runnable)`
  `void`
  `scheduleBackgroundProcessing(String id, long earliestBeginEpochMs, boolean requiresNetwork, boolean requiresPower, Runnable task)`
  Schedules a deferrable background processing task.
  `void`
  `scheduleBackgroundTask(Runnable r)`
  Allows executing a background task in a separate low priority thread.
  `void`
  `scheduleBackgroundWork(WorkRequest request)`
  Schedules constraint-aware background work.
  `void`
  `scheduleLocalNotification(LocalNotification n, long firstTime, int repeat)`
  Schedules a local notification that will occur after the given time elapsed.
  `void`
  `screenshot(SuccessCallback<Image> callback)`
  Captures a screenshot in the native layer which should include peer components as well.
  `void`
  `sendMessage(String[] recipients, String subject, Message msg)`
  Send an email using the platform mail client.
  `void`
  `sendSMS(String phoneNumber, String message)`
  Sends a SMS message to the given phone number
  `void`
  `sendSMS(String phoneNumber, String message, boolean interactive)`
  Sends a SMS message to the given phone number, the code below demonstrates the logic of detecting platform behavior for sending SMS.
  `void`
  `setAllowMinimizing(boolean allowMinimizing)`
  Allows a Codename One application to minimize without forcing it to the front whenever a new dialog is poped up
  `void`
  `setAutoFoldVKBOnFormSwitch(boolean autoFoldVKBOnFormSwitch)`
  Normally Codename One folds the VKB when switching forms this field allows us to block that behavior.
  `void`
  `setBadgeNumber(int number)`
  Sets the number that appears on the application icon in iOS
  `void`
  `setBidiAlgorithm(boolean activate)`
  Indicates whether Codename One should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.
  `void`
  `setBookmark(Runnable bookmark)`
  Sets a bookmark that can restore the app to a particular state.
  `void`
  `setBuiltinSoundsEnabled(boolean enabled)`
  Allows muting/unmuting the builtin sounds easily
  `void`
  `setCommandBehavior(int commandBehavior)`
  Indicates the way commands should be added to a form as one of the ocmmand constants defined in this class
  `void`
  `setCrashReporter(CrashReport crashReporter)`
  The crash reporter gets invoked when an uncaught exception is intercepted
  `void`
  `setDarkMode(Boolean darkMode)`
  Override the default dark mode setting
  `void`
  `setDefaultVirtualKeyboard(VirtualKeyboardInterface vkb)`
  Sets the default virtual keyboard to be used by the platform
  `void`
  `setDragStartPercentage(int dragStartPercentage)`
  This method allows us to manipulate the drag started detection logic.
  `void`
  `setEnableAsyncStackTraces(boolean enableAsyncStackTraces)`
  Enables or disables async stack traces.
  `void`
  `setFramerate(int rate)`
  Indicates the maximum frames the API will try to draw every second by default this is set to 10.
  `void`
  `setInitialWindowSizeHintPercent(Dimension hint)`
  Sets the initial desktop window size hint (percent of the desktop) that should be used when the first form is shown.
  `Timer`
  `setInterval(int period, Runnable r)`
  Convenience method to schedule a task to run on the EDT after periodms repeating every periodms.
  `void`
  `setLongPointerPressInterval(int v)`
  Long pointer press is invoked after the given interval, this allows making long press events shorter/longer
  `void`
  `setMultiKeyMode(boolean multiKeyMode)`
  When set to true Codename One allows multiple hardware keys to be pressed at once, this isn't on by default since it can trigger some complexities with UI navigation to/from native code
  `void`
  `setNativeCommands(boolean nativeCommands)`
  Indicates whether Codename One commands should be mapped to the native menus
  `void`
  `setNoSleep(boolean noSleep)`
  Calling this method with noSleep=true will cause the edt to run without sleeping.
  `void`
  `setPollingFrequency(int freq)`
  Sets the frequency for polling the server in case of polling based push notification
  `void`
  `setPreferredBackgroundFetchInterval(int seconds)`
  Sets the preferred time interval between background fetches.
  `void`
  `setProjectBuildHint(String key, String value)`
  Sets a build hint into the settings while overwriting any previous value.
  `void`
  `setProperty(String key, String value)`
  Sets a local property to the application, this method has no effect on the implementation code and only allows the user to override the logic of getProperty for internal application purposes.
  `void`
  `setPureTouch(boolean pureTouch)`
  A pure touch device has no focus showing when the user is using the touch interface.
  `void`
  `setScreenSaverEnabled(boolean e)`
  If isScreenSaverDisableSupported() returns true calling this method will lock the screen display on
  `void`
  `setShowDuringEditBehavior(int showDuringEdit)`
  Invoking the show() method of a form/dialog while the user is editing text in the native text box can have several behaviors: SHOW_DURING_EDIT_IGNORE, SHOW_DURING_EDIT_EXCEPTION, SHOW_DURING_EDIT_ALLOW_DISCARD, SHOW_DURING_EDIT_ALLOW_SAVE, SHOW_DURING_EDIT_SET_AS_NEXT
  `void`
  `setShowVirtualKeyboard(boolean show)`
  Displays the virtual keyboard on devices that support manually poping up the vitual keyboard
  `void`
  `setThirdSoftButton(boolean thirdSoftButton)`
  Indicates whether the 3rd softbutton should be supported on this device
  `Timer`
  `setTimeout(int timeout, Runnable r)`
  Convenience method to schedule a task to run on the EDT after timeoutms.
  `void`
  `setTouchScreenDevice(boolean touchScreen)`
  Indicates if this is a touch screen device that will return pen events, defaults to true if the device has pen events but can be overriden by the developer.
  `void`
  `setTransitionYield(int transitionD)`
  Indicates whether a delay should exist between calls to flush graphics during transition.
  `void`
  `setVirtualKeyboardListener(ActionListener l)`
  Sets a listener for VirtualKeyboard hide/show events.
  `void`
  `setWindowSize(int width, int height)`
  Requests a resize of the application window when supported by the platform.
  `void`
  `share(String toShare)`
  Share the required information using the platform sharing services.
  `void`
  `share(String text, String image, String mimeType)`
  Share the required information using the platform sharing services.
  `void`
  `share(String textOrPath, String image, String mimeType, Rectangle sourceRect)`
  Share the required information using the platform sharing services.
  `void`
  `share(String textOrPath, String image, String mimeType, Rectangle sourceRect, ShareResultListener listener)`
  Like `share(String,String,String,Rectangle)` but reports the outcome through `listener` on the EDT.
  `boolean`
  `shouldRenderSelection()`
  This is an internal state flag relevant only for pureTouch mode (otherwise it will always be true).
  `boolean`
  `shouldRenderSelection(Component c)`
  This is an internal state flag relevant only for pureTouch mode (otherwise it will always be true).
  `Object`
  `showNativePicker(int type, Component source, Object currentValue, Object data)`
  Shows a native modal dialog allowing us to perform the picking for the given type which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATE
  `void`
  `showNativeScreen(Object nativeFullScreenPeer)`
  Shows a native Form/Canvas or some other heavyweight native screen
  `void`
  `showNotify()`
  Broadcasts show notify into Codename One, this method is invoked by the Codename One implementation to notify Codename One of showNotify events
  `void`
  `sizeChanged(int w, int h)`
  Notifies Codename One of display size changes, this method is invoked by the implementation class and is for internal use
  `Object`
  `startForegroundService(String channelId, String title, String body, String iconName, ForegroundService.Task task, ForegroundService handle)`
  Starts a foreground service.
  `void`
  `startRemoteControl()`
  Starts the remote control service.
  `void`
  `startSpeechRecognition(RecognitionOptions options, RecognitionCallback callback)`
  Begins a speech-recognition session.
  `Thread`
  `startThread(Runnable r, String name)`
  Start a Codename One thread that supports crash protection and similar Codename One features.
  `void`
  `stopEditing(Component cmp)`
  Allows us to stop editString on the given text component
  `void`
  `stopEditing(Component cmp, Runnable onFinish)`
  Allows us to stop editString on the given text component or Form.
  `void`
  `stopForegroundService(Object nativeHandle)`
  Stops a foreground service.
  `void`
  `stopRemoteControl()`
  Stops the remote control service.
  `void`
  `stopSpeechRecognition()`
  `void`
  `subscribeToPushTopic(String topic)`
  Subscribes the device to a push topic.
  `String[]`
  `textToSpeechAvailableVoices()`
  `void`
  `textToSpeechSpeak(String text, TtsOptions options)`
  `void`
  `textToSpeechStop()`
  `void`
  `unlockOrientation()`
  This is the reverse method for lock orientation allowing orientation lock to be disabled
  `void`
  `unsubscribeFromPushTopic(String topic)`
  Unsubscribes the device from a push topic.
  `void`
  `updateForegroundServiceNotification(Object nativeHandle, String title, String body)`
  Updates a foreground service notification.
  `void`
  `vibrate(int duration)`
  Vibrates the device for the given length of time, notice that this might ignore the time value completely on some OS's where this level of control isn't supported e.g.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SOUND_TYPE_ALARM

    public static final String SOUND_TYPE_ALARM
    A common sound type that can be used with playBuiltinSound
    See Also:
      - Constant Field Values

  - ### SOUND_TYPE_CONFIRMATION

    public static final String SOUND_TYPE_CONFIRMATION
    A common sound type that can be used with playBuiltinSound
    See Also:
      - Constant Field Values

  - ### SOUND_TYPE_ERROR

    public static final String SOUND_TYPE_ERROR
    A common sound type that can be used with playBuiltinSound
    See Also:
      - Constant Field Values

  - ### SOUND_TYPE_INFO

    public static final String SOUND_TYPE_INFO
    A common sound type that can be used with playBuiltinSound
    See Also:
      - Constant Field Values

  - ### SOUND_TYPE_WARNING

    public static final String SOUND_TYPE_WARNING
    A common sound type that can be used with playBuiltinSound
    See Also:
      - Constant Field Values

  - ### SOUND_TYPE_BUTTON_PRESS

    public static final String SOUND_TYPE_BUTTON_PRESS
    A common sound type that can be used with playBuiltinSound
    See Also:
      - Constant Field Values

  - ### KEYBOARD_TYPE_UNKNOWN

    public static final int KEYBOARD_TYPE_UNKNOWN
    Unknown keyboard type is the default indicating the software should try to detect the keyboard type if necessary
    See Also:
      - Constant Field Values

  - ### KEYBOARD_TYPE_NUMERIC

    public static final int KEYBOARD_TYPE_NUMERIC
    Numeric keypad keyboard type
    See Also:
      - Constant Field Values

  - ### KEYBOARD_TYPE_QWERTY

    public static final int KEYBOARD_TYPE_QWERTY
    Full QWERTY keypad keyboard type, even if a numeric keyboard also exists
    See Also:
      - Constant Field Values

  - ### KEYBOARD_TYPE_VIRTUAL

    public static final int KEYBOARD_TYPE_VIRTUAL
    A touch based device that doesn't have a physical keyboard. Such a device pops up a virtual keyboad.
    See Also:
      - Constant Field Values

  - ### KEYBOARD_TYPE_HALF_QWERTY

    public static final int KEYBOARD_TYPE_HALF_QWERTY
    Half-QWERTY which needs software assistance for completion
    See Also:
      - Constant Field Values

  - ### GAME_FIRE

    public static final int GAME_FIRE
    Game action for fire
    See Also:
      - Constant Field Values

  - ### GAME_LEFT

    public static final int GAME_LEFT
    Game action for the left key
    See Also:
      - Constant Field Values

  - ### GAME_RIGHT

    public static final int GAME_RIGHT
    Game action for right key
    See Also:
      - Constant Field Values

  - ### GAME_UP

    public static final int GAME_UP
    Game action for UP key
    See Also:
      - Constant Field Values

  - ### GAME_DOWN

    public static final int GAME_DOWN
    Game action for down key
    See Also:
      - Constant Field Values

  - ### MEDIA_KEY_SKIP_FORWARD

    public static final int MEDIA_KEY_SKIP_FORWARD
    Special case game key used for media playback events
    See Also:
      - Constant Field Values

  - ### MEDIA_KEY_SKIP_BACK

    public static final int MEDIA_KEY_SKIP_BACK
    Special case game key used for media playback events
    See Also:
      - Constant Field Values

  - ### MEDIA_KEY_PLAY

    public static final int MEDIA_KEY_PLAY
    Special case game key used for media playback events
    See Also:
      - Constant Field Values

  - ### MEDIA_KEY_STOP

    public static final int MEDIA_KEY_STOP
    Special case game key used for media playback events
    See Also:
      - Constant Field Values

  - ### MEDIA_KEY_PLAY_STOP

    public static final int MEDIA_KEY_PLAY_STOP
    Special case game key used for media playback events
    See Also:
      - Constant Field Values

  - ### MEDIA_KEY_PLAY_PAUSE

    public static final int MEDIA_KEY_PLAY_PAUSE
    Special case game key used for media playback events
    See Also:
      - Constant Field Values

  - ### MEDIA_KEY_FAST_FORWARD

    public static final int MEDIA_KEY_FAST_FORWARD
    Special case game key used for media playback events
    See Also:
      - Constant Field Values

  - ### MEDIA_KEY_FAST_BACKWARD

    public static final int MEDIA_KEY_FAST_BACKWARD
    Special case game key used for media playback events
    See Also:
      - Constant Field Values

  - ### KEY_POUND

    public static final int KEY_POUND
    An attribute that encapsulates '#' int value.
    See Also:
      - Constant Field Values

  - ### SHOW_DURING_EDIT_IGNORE

    public static final int SHOW_DURING_EDIT_IGNORE
    Ignore all calls to show occurring during edit, they are discarded immediately
    See Also:
      - Constant Field Values

  - ### SHOW_DURING_EDIT_EXCEPTION

    public static final int SHOW_DURING_EDIT_EXCEPTION
    If show is called while editing text in the native text box an exception is thrown
    See Also:
      - Constant Field Values

  - ### SHOW_DURING_EDIT_ALLOW_DISCARD

    public static final int SHOW_DURING_EDIT_ALLOW_DISCARD
    Allow show to occur during edit and discard all user input at this moment
    See Also:
      - Constant Field Values

  - ### SHOW_DURING_EDIT_ALLOW_SAVE

    public static final int SHOW_DURING_EDIT_ALLOW_SAVE
    Allow show to occur during edit and save all user input at this moment
    See Also:
      - Constant Field Values

  - ### SHOW_DURING_EDIT_SET_AS_NEXT

    public static final int SHOW_DURING_EDIT_SET_AS_NEXT
    Show will update the current form to which the OK button of the text box will return
    See Also:
      - Constant Field Values

  - ### COMMAND_BEHAVIOR_DEFAULT

    public static final int COMMAND_BEHAVIOR_DEFAULT
    Indicates that the Codename One implementation should decide internally the command behavior most appropriate for this platform.
    See Also:
      - Constant Field Values

  - ### COMMAND_BEHAVIOR_SOFTKEY

    public static final int COMMAND_BEHAVIOR_SOFTKEY
    Indicates the classic Codename One command behavior where the commands are placed in a list within a dialog. This is the most customizable approach for none touch devices.
    See Also:
      - Constant Field Values

  - ### COMMAND_BEHAVIOR_TOUCH_MENU

    public static final int COMMAND_BEHAVIOR_TOUCH_MENU
    Indicates the touch menu dialog rendered by Codename One where commands are placed into a scrollable dialog
    See Also:
      - Constant Field Values

  - ### COMMAND_BEHAVIOR_BUTTON_BAR

    public static final int COMMAND_BEHAVIOR_BUTTON_BAR
    Indicates that commands should be added to an always visible bar at the bottom of the form.
    See Also:
      - Constant Field Values

  - ### COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_BACK

    public static final int COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_BACK
    Identical to the bar behavior, places the back command within the title bar of the form/dialg
    See Also:
      - Constant Field Values

  - ### COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_RIGHT

    public static final int COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_RIGHT
    Places all commands on the right side of the title bar with a uniform size grid layout
    See Also:
      - Constant Field Values

  - ### COMMAND_BEHAVIOR_ICS

    public static final int COMMAND_BEHAVIOR_ICS
    Commands are placed in the same was as they are in the ice cream sandwich Android OS update where the back button has a theme icon the application icon appears next to the
    See Also:
      - Constant Field Values

  - ### COMMAND_BEHAVIOR_SIDE_NAVIGATION

    public static final int COMMAND_BEHAVIOR_SIDE_NAVIGATION
    Commands are placed in a side menu similar to Facebook/Google+ apps
    See Also:
      - Constant Field Values

  - ### COMMAND_BEHAVIOR_NATIVE

    public static final int COMMAND_BEHAVIOR_NATIVE
    Indicates that commands should try to add themselves to the native menus
    See Also:
      - Constant Field Values

  - ### WINDOW_SIZE_HINT_PERCENT

    public static final String WINDOW_SIZE_HINT_PERCENT
    Client property key used on the first shown `Form` to indicate the desired initial window size as a percentage of the available desktop. The value should be a `com.codename1.ui.geom.Dimension` whose width and height represent percentages.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### init

    public static void init(Object m)

    This is the INTERNAL Display initialization method, it will be removed in future versions of the API. This method must be called before any Form is shown

    ###### Parameters

    - `m`: platform specific object used by the implementation

    ###### Deprecated

    this method is invoked internally do not invoke it!

  - ### deinitialize

    public static void deinitialize()
    Closes down the EDT and Codename One, under normal conditions this method is completely unnecessary since exiting the application will shut down Codename One. However, if the application is minimized and the user wishes to free all resources without exiting the application then this method can be used. Once this method is used Codename One will no longer work and Display.init(Object) should be invoked again for any further Codename One call! Notice that minimize (being a Codename One method) MUST be invoked before invoking this method!

  - ### isInitialized

    public static boolean isInitialized()

    This method returns true if the Display is initialized.

    ###### Returns

    true if the EDT is running

  - ### getInstance

    public static Display getInstance()

    Return the Display instance

    ###### Returns

    the Display instance

  - ### setBookmark

    public void setBookmark(Runnable bookmark)

    Sets a bookmark that can restore the app to a particular state. This takes a `Runnable` that will be run when `#restoreToBookmark()` () } is called.

    The primary purpose of this feature is live code refresh.

    ###### Parameters

    - `bookmark`: A `Runnable` that can be run to restore the app to a particular point.

    ###### Since

    8.0

  - ### restoreToBookmark

    public void restoreToBookmark()

    Runs the last bookmark that was set using `#setBookmark(java.lang.Runnable)`

    ###### Since

    8.0

  - ### getPluginSupport

    public PluginSupport getPluginSupport()

    Gets reference to plugin support object.

    ###### Returns

    The plugin support object.

    ###### Since

    8.0

  - ### getDragStartPercentage

    public int getDragStartPercentage()

    This method allows us to manipulate the drag started detection logic. If the pointer was dragged for more than this percentage of the display size it is safe to assume that a drag is in progress.

    ###### Returns

    motion percentage

  - ### setDragStartPercentage

    public void setDragStartPercentage(int dragStartPercentage)

    This method allows us to manipulate the drag started detection logic. If the pointer was dragged for more than this percentage of the display size it is safe to assume that a drag is in progress.

    ###### Parameters

    - `dragStartPercentage`: percentage of the screen required to initiate drag

  - ### getWifiPlatform

    public WifiPlatform getWifiPlatform()
    Returns the platform's WiFi implementation. Used by `com.codename1.io.wifi.WiFi`; applications normally talk to that static facade rather than calling this directly.

  - ### getWifiDirectPlatform

    public WifiDirectPlatform getWifiDirectPlatform()
    Returns the platform's WiFi-Direct implementation.

  - ### getBonjourPlatform

    public BonjourPlatform getBonjourPlatform()
    Returns the platform's Bonjour / mDNS implementation.

  - ### getUsbPlatform

    public UsbPlatform getUsbPlatform()
    Returns the platform's USB host implementation.

  - ### getNetworkTypePlatform

    public NetworkTypePlatform getNetworkTypePlatform()
    Returns the platform's network-type tracker used by `NetworkManager.addNetworkTypeListener(...)`.

  - ### getSimd

    public Simd getSimd()
    Returns the SIMD API instance bound to the current implementation.

  - ### setFramerate

    public void setFramerate(int rate)

    Indicates the maximum frames the API will try to draw every second by default this is set to 10. The advantage of limiting framerate is to allow the CPU to perform other tasks besides drawing. Notice that when no change is occurring on the screen no frame is drawn and so a high/low FPS will have no effect then. 10FPS would be very reasonable for a business application.

    ###### Parameters

    - `rate`: the frame rate

  - ### vibrate

    public void vibrate(int duration)

    Vibrates the device for the given length of time, notice that this might ignore the time value completely on some OS's where this level of control isn't supported e.g. iOS see: https://github.com/codenameone/CodenameOne/issues/1904

    ###### Parameters

    - `duration`: length of time to vibrate (might be ignored)

  - ### flashBacklight

    public void flashBacklight(int duration)

    Flash the backlight of the device for the given length of time

    ###### Parameters

    - `duration`: length of time to flash the backlight

    ###### Deprecated

    this refers to functionality of devices that are no longer sold, not to the devices "flash"

  - ### announceForAccessibility

    public void announceForAccessibility(Component cmp, String text)

    Manually announces text to native accessibility services, optionally associating the announcement with a specific component. Most assistive technologies will announce a component automatically when it gains focus; this method is intended for situations where an announcement should occur independently of focus changes.

    ###### Parameters

    - `cmp`: the component related to this announcement or `null` for the root view

    - `text`: the message to announce

  - ### announceForAccessibility

    public void announceForAccessibility(String text)

    Convenience overload to announce text without specifying a component.

    ###### Parameters

    - `text`: the message to announce

  - ### getShowDuringEditBehavior

    public int getShowDuringEditBehavior()

    Returns the status of the show during edit flag

    ###### Returns

    Returns:

      one of the following: SHOW_DURING_EDIT_IGNORE, SHOW_DURING_EDIT_EXCEPTION, SHOW_DURING_EDIT_ALLOW_DISCARD, SHOW_DURING_EDIT_ALLOW_SAVE, SHOW_DURING_EDIT_SET_AS_NEXT

      ###### Deprecated

      this method isn't applicable in modern devices

  - ### setShowDuringEditBehavior

    public void setShowDuringEditBehavior(int showDuringEdit)

    Invoking the show() method of a form/dialog while the user is editing text in the native text box can have several behaviors: SHOW_DURING_EDIT_IGNORE, SHOW_DURING_EDIT_EXCEPTION, SHOW_DURING_EDIT_ALLOW_DISCARD, SHOW_DURING_EDIT_ALLOW_SAVE, SHOW_DURING_EDIT_SET_AS_NEXT

    ###### Parameters

    - `showDuringEdit`: @param showDuringEdit one of the following: SHOW_DURING_EDIT_IGNORE, SHOW_DURING_EDIT_EXCEPTION, SHOW_DURING_EDIT_ALLOW_DISCARD, SHOW_DURING_EDIT_ALLOW_SAVE, SHOW_DURING_EDIT_SET_AS_NEXT

    ###### Deprecated

    this method isn't applicable in modern devices

  - ### getFrameRate

    public int getFrameRate()

    Indicates the maximum frames the API will try to draw every second

    ###### Returns

    the frame rate

  - ### isEdt

    public boolean isEdt()

    Returns true if we are currently in the event dispatch thread. This is useful for generic code that can be used both with the EDT and outside of it.

    ###### Returns

    Returns:
      true if we are currently in the event dispatch thread; otherwise false

  - ### stopRemoteControl

    public void stopRemoteControl()

    Stops the remote control service. This should be implemented in the platform to handle unbinding the `com.codename1.media.RemoteControlListener` with the platform's remote control.

    This is executed when a new listener is registered using `com.codename1.media.MediaManager#setRemoteControlListener(com.codename1.media.RemoteControlListener)`

    ###### Since

    7.0

  - ### startRemoteControl

    public void startRemoteControl()

    Starts the remote control service. This should be implemented in the platform to handle binding the `RemoteControlListener` with the platform's remote control.

    This is executed when the user registers a new listener using `MediaManager#setRemoteControlListener(com.codename1.media.RemoteControlListener)`

    ###### Since

    7.0

  - ### isDarkMode

    public Boolean isDarkMode()

    Returns true if the platform is in dark mode, null is returned for unknown status

    ###### Returns

    true in case of dark mode

  - ### setDarkMode

    public void setDarkMode(Boolean darkMode)

    Override the default dark mode setting

    ###### Parameters

    - `darkMode`: can be set to null to reset to platform default

  - ### isLargerTextEnabled

    public boolean isLargerTextEnabled()

    Returns true if the user has selected larger type fonts in the system settings.

    ###### Returns

    true when the platform indicates a larger text preference.

    ###### Since

    7.1

  - ### getLargerTextScale

    public float getLargerTextScale()

    Returns a scale factor representing how much larger system fonts should be. A value of `1.0` indicates the default system font size.

    ###### Returns

    scale factor for larger system fonts.

    ###### Since

    7.1

  - ### isEnableAsyncStackTraces

    public boolean isEnableAsyncStackTraces()

    Checks if async stack traces are enabled. If enabled, the stack trace at the point of `#callSerially(java.lang.Runnable)` calls will be recorded, and logged in the case that there is an uncaught exception.

    Currently this is only supported in the JavaSE/Simulator port.

    ###### Returns

    Whether async stack traces are enabled.

    ###### Since

    7.0

    ###### See also

    - #setEnableAsyncStackTraces(boolean)

  - ### setEnableAsyncStackTraces

    public void setEnableAsyncStackTraces(boolean enableAsyncStackTraces)

    Enables or disables async stack traces. If enabled, the stack trace at the point of `#callSerially(java.lang.Runnable)` calls will be recorded, and logged in the case that there is an uncaught exception.

    Currently this is only supported in the JavaSE/Simulator port.

    ###### Parameters

    - `enableAsyncStackTraces`: True to enable async stack traces.

    ###### Since

    7.0

    ###### See also

    - #isEnableAsyncStackTraces()

  - ### callSerially

    public void callSerially(Runnable r)

    Causes the runnable to be invoked on the event dispatch thread. This method returns immediately and will not wait for the serial call to occur

    ###### Parameters

    - `r`: @param r runnable (NOT A THREAD!) that will be invoked on the EDT serial to the paint and key handling events

  - ### callSeriallyOnIdle

    public void callSeriallyOnIdle(Runnable r)

    Causes the runnable to be invoked on the event dispatch thread when the event dispatch thread is idle. This method returns immediately and will not wait for the serial call to occur. Notice this method is identical to call serially but will perform the runnable only when the EDT is idle

    ###### Parameters

    - `r`: @param r runnable (NOT A THREAD!) that will be invoked on the EDT serial to the paint and key handling events

  - ### getLineSeparator

    public String getLineSeparator()

  - ### scheduleBackgroundTask

    public void scheduleBackgroundTask(Runnable r)

    Allows executing a background task in a separate low priority thread. Tasks are serialized so they don't overload the CPU.

    ###### Parameters

    - `r`: the task to perform in the background

  - ### callSeriallyAndWait

    public void callSeriallyAndWait(Runnable r)

    Identical to callSerially with the added benefit of waiting for the Runnable method to complete.

    ###### Parameters

    - `r`: @param r runnable (NOT A THREAD!) that will be invoked on the EDT serial to the paint and key handling events

    ###### Throws

    - `IllegalStateException`: @throws IllegalStateException if this method is invoked on the event dispatch thread (e.g. during paint or event handling).

  - ### platformUsesInputMode

    public boolean platformUsesInputMode()

    Checks if this platform uses input modes. No current platforms return true for this. It is a holdover from J2ME.

    ###### Returns

    True if the platform supports input modes. Only true for J2ME and RIM.

  - ### callSeriallyAndWait

    public void callSeriallyAndWait(Runnable r, int timeout)

    Identical to callSerially with the added benefit of waiting for the Runnable method to complete.

    ###### Parameters

    - `r`: @param r runnable (NOT A THREAD!) that will be invoked on the EDT serial to the paint and key handling events

    - `timeout`: timeout duration, on timeout the method just returns

    ###### Throws

    - `IllegalStateException`: @throws IllegalStateException if this method is invoked on the event dispatch thread (e.g. during paint or event handling).

  - ### isInTransition

    public boolean isInTransition()

    Returns true if the system is currently in the process of transitioning between forms

    ###### Returns

    true if in the middle of form transition

  - ### getStackTrace

    public String getStackTrace(Thread parentThread, Throwable t)

    Returns the stack trace from the exception on the given thread. This API isn't supported on all platforms and may return a blank string when unavailable.

    ###### Parameters

    - `parentThread`: the thread in which the exception was thrown

    - `t`: the exception

    ###### Returns

    a stack trace string that might be blank

  - ### onEditingComplete

    public void onEditingComplete(Component c, String text)

    Called by the underlying implementation to indicate that editing in the native system has completed and changes should propagate into Codename One

    ###### Parameters

    - `c`: edited component

    - `text`: new text for the component

  - ### invokeWithoutBlocking

    public void invokeWithoutBlocking(Runnable r)

    Invokes a Runnable with blocking disabled. If any attempt is made to block (i.e. call `#invokeAndBlock(java.lang.Runnable)` from inside this Runnable, it will result in a `BlockingDisallowedException` being thrown.

    ###### Parameters

    - `r`: Runnable to be run immediately.

    ###### Throws

    - `BlockingDisallowedException`: @throws BlockingDisallowedException If `#invokeAndBlock(java.lang.Runnable)` is attempted anywhere in the Runnable.

    ###### Since

    7.0

  - ### invokeWithoutBlockingWithResultSync

    public <T> T invokeWithoutBlockingWithResultSync(RunnableWithResultSync<T> r)

    Invokes a RunnableWithResultSync with blocking disabled. If any attempt is made to block (i.e. call `#invokeAndBlock(java.lang.Runnable)` from inside this Runnable, it will result in a `BlockingDisallowedException` being thrown.

    ###### Parameters

    - `r`: RunnableWithResultSync to be run immediately.

    ###### Throws

    - `BlockingDisallowedException`: @throws BlockingDisallowedException If `#invokeAndBlock(java.lang.Runnable)` is attempted anywhere in the Runnable.

    ###### Since

    7.0

  - ### invokeAndBlock

    public void invokeAndBlock(Runnable r, boolean dropEvents)

    Invokes runnable and blocks the current thread, if the current thread is the EDT it will still be blocked in a way that doesn't break event dispatch . Important: calling this method spawns a new thread that shouldn't access the UI!

    See this section in the developer guide for further information.

    ###### Parameters

    - `r`: runnable (NOT A THREAD!) that will be invoked synchronously by this method

    - `dropEvents`: @param dropEvents indicates if the display should drop all events while this runnable is running

    ###### Throws

    - `BlockingDisallowedException`: @throws BlockingDisallowedException if this method is called while blocking is disabled (i.e. we are running inside a call to `#invokeWithoutBlocking(java.lang.Runnable)` on the EDT).

  - ### invokeAndBlock

    public void invokeAndBlock(Runnable r)

    Invokes runnable and blocks the current thread, if the current thread is the EDT it will still be blocked in a way that doesn't break event dispatch . Important: calling this method spawns a new thread that shouldn't access the UI!

    See this section in the developer guide for further information.

    ###### Parameters

    - `r`: runnable (NOT A THREAD!) that will be invoked synchroniously by this method

  - ### isTouchScreenDevice

    public boolean isTouchScreenDevice()

    The name of this method is misleading due to it's legacy. It will return true on the desktop too where the mouse sends pointer events.

    ###### Returns

    true if this device supports touch/pointer events

  - ### setTouchScreenDevice

    public void setTouchScreenDevice(boolean touchScreen)

    Indicates if this is a touch screen device that will return pen events, defaults to true if the device has pen events but can be overriden by the developer.

    ###### Parameters

    - `touchScreen`: false if this is not a touch screen device

  - ### setNoSleep

    public void setNoSleep(boolean noSleep)

    Calling this method with noSleep=true will cause the edt to run without sleeping.

    ###### Parameters

    - `noSleep`: causes the edt to stop the sleeping periods between 2 cycles

  - ### setTransitionYield

    public void setTransitionYield(int transitionD)

    Indicates whether a delay should exist between calls to flush graphics during transition. In some devices flushGraphics is asynchronious causing it to be very slow with our background thread. The solution is to add a short wait allowing the implementation time to paint the screen. This value is set automatically by default but can be overriden for some devices.

    ###### Parameters

    - `transitionD`: -1 for no delay otherwise delay in milliseconds

  - ### editString

    public void editString(Component cmp, int maxSize, int constraint, String text)

    Fires the native in place text editing logic, normally you wouldn't invoke this API directly and instead use an API like `com.codename1.ui.TextArea#startEditingAsync()`, `com.codename1.ui.TextArea#startEditing()` or `com.codename1.ui.Form#setEditOnShow(com.codename1.ui.TextArea)`.

    ###### Parameters

    - `cmp`: the `TextArea` component

    - `maxSize`: the maximum size from the text area

    - `constraint`: the constraints of the text area

    - `text`: the string to edit

  - ### editString

    public void editString(Component cmp, int maxSize, int constraint, String text, int initiatingKeycode)

    Fires the native in place text editing logic, normally you wouldn't invoke this API directly and instead use an API like `com.codename1.ui.TextArea#startEditingAsync()`, `com.codename1.ui.TextArea#startEditing()` or `com.codename1.ui.Form#setEditOnShow(com.codename1.ui.TextArea)`.

    ###### Parameters

    - `cmp`: the `TextArea` component

    - `maxSize`: the maximum size from the text area

    - `constraint`: the constraints of the text area

    - `text`: the string to edit

    - `initiatingKeycode`: the keycode used to initiate the edit.

  - ### stopEditing

    public void stopEditing(Component cmp)

    Allows us to stop editString on the given text component

    ###### Parameters

    - `cmp`: the text field/text area component

  - ### stopEditing

    public void stopEditing(Component cmp, Runnable onFinish)

    Allows us to stop editString on the given text component or Form. If cmp is a `Form`, it will stop editing in any active component on the form, and close the keyboard if it is opened.

    ###### Parameters

    - `cmp`: the text field/text area component

    - `onFinish`: invoked when editing stopped

  - ### minimizeApplication

    public boolean minimizeApplication()

    Minimizes the current application if minimization is supported by the platform (may fail). Returns false if minimization failed.

    ###### Returns

    false if minimization failed true if it succeeded or seems to be successful

  - ### isMinimized

    public boolean isMinimized()

    Indicates whether an application is minimized

    ###### Returns

    true if the application is minimized

  - ### restoreMinimizedApplication

    public void restoreMinimizedApplication()
    Restore the minimized application if minimization is supported by the platform

  - ### isControlKeyDown

    public boolean isControlKeyDown()
    Checks if the control key is currently down. Only relevant for desktop ports.

  - ### isMetaKeyDown

    public boolean isMetaKeyDown()
    Checks if the meta key is currently down. Only relevant for desktop ports.

  - ### isAltKeyDown

    public boolean isAltKeyDown()
    Checks if the alt key is currently down. Only relevant for desktop ports.

  - ### isAltGraphKeyDown

    public boolean isAltGraphKeyDown()
    Checks if the altgraph key is currently down. Only relevant for desktop ports.

  - ### isRightMouseButtonDown

    public boolean isRightMouseButtonDown()

    Checks if the last mouse press was a right click.

    ###### Returns

    True if the last mouse press was a right click.

    ###### Since

    7.0

  - ### isShiftKeyDown

    public boolean isShiftKeyDown()
    Checks if shift key is currently down. Only relevant for desktop ports.

  - ### keyPressed

    public void keyPressed(int keyCode)

    Pushes a key press event with the given keycode into Codename One

    ###### Parameters

    - `keyCode`: keycode of the key event

  - ### keyReleased

    public void keyReleased(int keyCode)

    Pushes a key release event with the given keycode into Codename One

    ###### Parameters

    - `keyCode`: keycode of the key event

  - ### pointerDragged

    public void pointerDragged(int[] x, int[] y)

    Pushes a pointer drag event with the given coordinates into Codename One

    ###### Parameters

    - `x`: the x position of the pointer

    - `y`: the y position of the pointer

  - ### pointerHover

    public void pointerHover(int[] x, int[] y)

    Pushes a pointer hover event with the given coordinates into Codename One

    ###### Parameters

    - `x`: the x position of the pointer

    - `y`: the y position of the pointer

  - ### pointerHoverPressed

    public void pointerHoverPressed(int[] x, int[] y)

    Pushes a pointer hover release event with the given coordinates into Codename One

    ###### Parameters

    - `x`: the x position of the pointer

    - `y`: the y position of the pointer

  - ### pointerHoverReleased

    public void pointerHoverReleased(int[] x, int[] y)

    Pushes a pointer hover release event with the given coordinates into Codename One

    ###### Parameters

    - `x`: the x position of the pointer

    - `y`: the y position of the pointer

  - ### pointerPressed

    public void pointerPressed(int[] x, int[] y)

    Pushes a pointer press event with the given coordinates into Codename One

    ###### Parameters

    - `x`: the x position of the pointer

    - `y`: the y position of the pointer

  - ### pointerReleased

    public void pointerReleased(int[] x, int[] y)

    Pushes a pointer release event with the given coordinates into Codename One

    ###### Parameters

    - `x`: the x position of the pointer

    - `y`: the y position of the pointer

  - ### sizeChanged

    public void sizeChanged(int w, int h)

    Notifies Codename One of display size changes, this method is invoked by the implementation class and is for internal use

    ###### Parameters

    - `w`: the width of the drawing surface

    - `h`: the height of the drawing surface

  - ### hideNotify

    public void hideNotify()
    Broadcasts hide notify into Codename One, this method is invoked by the Codename One implementation to notify Codename One of hideNotify events

  - ### showNotify

    public void showNotify()
    Broadcasts show notify into Codename One, this method is invoked by the Codename One implementation to notify Codename One of showNotify events

  - ### hasDragOccured

    public boolean hasDragOccured()

    This method should be invoked by components that broadcast events on the pointerReleased callback. This method will indicate if a drag occured since the pointer press event, notice that this method will not behave as expected for multi-touch events.

    ###### Returns

    true if a drag has occured since the last pointer pressed

  - ### getCurrent

    public Form getCurrent()

    Return the form currently displayed on the screen or null if no form is currently displayed.

    ###### Returns

    Returns:
      the form currently displayed on the screen or null if no form is currently displayed

  - ### numAlphaLevels

    public int numAlphaLevels()

    Return the number of alpha levels supported by the implementation.

    ###### Returns

    the number of alpha levels supported by the implementation

    ###### Deprecated

    this method isn't implemented in most modern devices

  - ### numColors

    public int numColors()

    Returns the number of colors applicable on the device, note that the API does not support gray scale devices.

    ###### Returns

    the number of colors applicable on the device

    ###### Deprecated

    this method isn't implemented in most modern devices

  - ### getDisplayWidth

    public int getDisplayWidth()

    Return the width of the display

    ###### Returns

    the width of the display

  - ### getDisplayHeight

    public int getDisplayHeight()

    Return the height of the display

    ###### Returns

    the height of the display

  - ### getDesktopSize

    public Dimension getDesktopSize()

    Returns the size of the desktop hosting the application window when running on a desktop platform.

    ###### Returns

    the desktop size or the current display size if not supported

  - ### getWindowBounds

    public Rectangle getWindowBounds()

    Returns the current window bounds when running on a desktop platform.

    ###### Returns

    the bounds of the application window

  - ### setWindowSize

    public void setWindowSize(int width, int height)

    Requests a resize of the application window when supported by the platform.

    ###### Parameters

    - `width`: the desired window width

    - `height`: the desired window height

  - ### getInitialWindowSizeHintPercent

    public Dimension getInitialWindowSizeHintPercent()

    Returns the initial desktop window size hint provided by the first shown form, when available.

    ###### Returns

    the stored hint or `null`

  - ### setInitialWindowSizeHintPercent

    public void setInitialWindowSizeHintPercent(Dimension hint)

    Sets the initial desktop window size hint (percent of the desktop) that should be used when the first form is shown. This is primarily useful for desktop environments where the Codename One application is hosted in a window rather than full-screen.

    ###### Parameters

    - `hint`: @param hint a `Dimension` whose width/height represent percentages of the desktop to use for the initial window size, or `null` to clear a previously stored hint

  - ### convertToPixels

    public int convertToPixels(int dipCount, boolean horizontal)

    Converts the dips count to pixels, dips are roughly 1mm in length. This is a very rough estimate and not to be relied upon

    ###### Parameters

    - `dipCount`: the dips that we will convert to pixels

    - `horizontal`: indicates pixels in the horizontal plane

    ###### Returns

    value in pixels

  - ### convertToPixels

    public int convertToPixels(float value, byte unitType)

    Converts from specified unit to pixels.

    ###### Parameters

    - `value`: The value to convert, expressed in unitType.

    - `unitType`: @param unitType The unit type. One of `Style#UNIT_TYPE_DIPS`, `Style#UNIT_TYPE_PIXELS`, `Style#UNIT_TYPE_REM`, `Style#UNIT_TYPE_SCREEN_PERCENTAGE`, `Style#UNIT_TYPE_VH`, `Style#UNIT_TYPE_VW`, `Style#UNIT_TYPE_VMIN`, `Style#UNIT_TYPE_VMAX`

    ###### Returns

    The value converted to pixels.

    ###### Since

    8.0

  - ### convertToPixels

    public int convertToPixels(float value, byte unitType, boolean horizontal)

    Converts from specified unit to pixels.

    ###### Parameters

    - `value`: The value to convert, expressed in unitType.

    - `unitType`: @param unitType The unit type. One of `Style#UNIT_TYPE_DIPS`, `Style#UNIT_TYPE_PIXELS`, `Style#UNIT_TYPE_REM`, `Style#UNIT_TYPE_SCREEN_PERCENTAGE`, `Style#UNIT_TYPE_VH`, `Style#UNIT_TYPE_VW`, `Style#UNIT_TYPE_VMIN`, `Style#UNIT_TYPE_VMAX`

    - `horizontal`: Whether screen percentage units should be based on horitonzal or vertical percentage.

    ###### Returns

    The value converted to pixels.

    ###### Since

    8.0

  - ### convertToPixels

    public int convertToPixels(float dipCount)

    Converts the dips count to pixels, dips are roughly 1mm in length. This is a very rough estimate and not to be relied upon. This version of the method assumes square pixels which is pretty much the norm.

    ###### Parameters

    - `dipCount`: the dips that we will convert to pixels

    ###### Returns

    value in pixels

  - ### getGameAction

    public int getGameAction(int keyCode)

    Returns the game action code matching the given key combination

    ###### Parameters

    - `keyCode`: key code received from the event

    ###### Returns

    game action matching this keycode

  - ### getKeyCode

    public int getKeyCode(int gameAction)

    Returns the keycode matching the given game action constant (the opposite of getGameAction). On some devices getKeyCode returns numeric keypad values for game actions, this breaks the code since we filter these values (to prevent navigation on '2'). We pick unused negative values for game keys and assign them to game keys for getKeyCode so they will work with getGameAction.

    ###### Parameters

    - `gameAction`: game action constant from this class

    ###### Returns

    keycode matching this constant

    ###### Deprecated

  - ### isThirdSoftButton

    public boolean isThirdSoftButton()

    Indicates whether the 3rd softbutton should be supported on this device

    ###### Returns

    true if a third softbutton should be used

  - ### setThirdSoftButton

    public void setThirdSoftButton(boolean thirdSoftButton)

    Indicates whether the 3rd softbutton should be supported on this device

    ###### Parameters

    - `thirdSoftButton`: true if a third softbutton should be used

  - ### setShowVirtualKeyboard

    public void setShowVirtualKeyboard(boolean show)

    Displays the virtual keyboard on devices that support manually poping up the vitual keyboard

    ###### Parameters

    - `show`: toggles the virtual keyboards visibility

    ###### Deprecated

  - ### isVirtualKeyboardShowing

    public boolean isVirtualKeyboardShowing()

    Indicates if the virtual keyboard is currently showing or not

    ###### Returns

    true if the virtual keyboard is showing

    ###### Deprecated

  - ### getSupportedVirtualKeyboard

    public String[] getSupportedVirtualKeyboard()

    Returns all platform supported virtual keyboards names

    ###### Returns

    all platform supported virtual keyboards names

    ###### Deprecated

    this method is only used in feature phones and has no modern equivalent

  - ### registerVirtualKeyboard

    public void registerVirtualKeyboard(VirtualKeyboardInterface vkb)

    Register a virtual keyboard

    ###### Parameters

    - `vkb`

    ###### Deprecated

    this method is only used in feature phones and has no modern equivalent

  - ### getDefaultVirtualKeyboard

    public VirtualKeyboardInterface getDefaultVirtualKeyboard()

    Get the default virtual keyboard or null if the VirtualKeyboard is disabled

    ###### Returns

    the default vkb

    ###### Deprecated

    this method is only used in feature phones and has no modern equivalent

  - ### setDefaultVirtualKeyboard

    public void setDefaultVirtualKeyboard(VirtualKeyboardInterface vkb)

    Sets the default virtual keyboard to be used by the platform

    ###### Parameters

    - `vkb`: @param vkb a VirtualKeyboard to be used or null to disable the VirtualKeyboard

    ###### Deprecated

    this method is only used in feature phones and has no modern equivalent

  - ### getVirtualKeyboardListener

    public ActionListener getVirtualKeyboardListener()

    Gets the VirtualKeyboardListener Objects of exists.

    ###### Returns

    a Listener Object or null if not exists

    ###### Deprecated

    Use `#removeVirtualKeyboardListener(com.codename1.ui.events.ActionListener)`

  - ### setVirtualKeyboardListener

    public void setVirtualKeyboardListener(ActionListener l)

    Sets a listener for VirtualKeyboard hide/show events. The Listener will get an event once the keyboard is opened/closed with a Boolean value that represents the state of the keyboard true for open and false for closed getSource() on the ActionEvent will return the Boolean value.

    ###### Parameters

    - `l`: the listener

    ###### Deprecated

    Use `#addVirtualKeyboardListener(com.codename1.ui.events.ActionListener)`

  - ### addVirtualKeyboardListener

    public void addVirtualKeyboardListener(ActionListener l)

    Adds a listener for VirtualKeyboard hide/show events. ActionEvents will return a Boolean value for `ActionEvent#getSource()`, with Boolean.TRUE on show, and Boolean.FALSE on hide.

    Note: Keyboard events may not be 100% reliable as they use heuristics on most platforms to guess when the keyboard is shown or hidden.

    ###### Parameters

    - `l`: The listener.

    ###### Since

    6.0

    ###### See also

    - #removeVirtualKeyboardListener(com.codename1.ui.events.ActionListener)

  - ### removeVirtualKeyboardListener

    public void removeVirtualKeyboardListener(ActionListener l)

    Removes a listener for VirtualKeyboard hide/show events. ActionEvents will return a Boolean value for `ActionEvent#getSource()`, with Boolean.TRUE on show, and Boolean.FALSE on hide.

    Note: Keyboard events may not be 100% reliable as they use heuristics on most platforms to guess when the keyboard is shown or hidden.

    ###### Parameters

    - `l`: The listener.

    ###### Since

    6.0

    ###### See also

    - #addVirtualKeyboardListener(com.codename1.ui.events.ActionListener)

  - ### fireVirtualKeyboardEvent

    public void fireVirtualKeyboardEvent(boolean show)

    Fires a virtual keyboard show event.

    ###### Parameters

    - `show`

    ###### Since

    6.0

  - ### getInvisibleAreaUnderVKB

    public int getInvisibleAreaUnderVKB()

    Gets the invisible area under the Virtual Keyboard.

    ###### Returns

    Height of the VKB that overlaps the screen.

    ###### Since

    6.0

  - ### getKeyboardType

    public int getKeyboardType()

    Returns the type of the input device one of: KEYBOARD_TYPE_UNKNOWN, KEYBOARD_TYPE_NUMERIC, KEYBOARD_TYPE_QWERTY, KEYBOARD_TYPE_VIRTUAL, KEYBOARD_TYPE_HALF_QWERTY

    ###### Returns

    KEYBOARD_TYPE_UNKNOWN

  - ### isNativeInputSupported

    public boolean isNativeInputSupported()

    Indicates whether the device supports native in place editing in which case lightweight input logic shouldn't be used for input.

    ###### Returns

    false by default

  - ### isMultiTouch

    public boolean isMultiTouch()

    Indicates whether the device supports multi-touch events, this is only relevant when touch events are supported

    ###### Returns

    false by default

  - ### isClickTouchScreen

    public boolean isClickTouchScreen()

    Indicates whether the device has a double layer screen thus allowing two stages to touch events: click and hover. This is true for devices such as the storm but can also be true for a PC with a mouse pointer floating on top.

    A click touch screen will also send pointer hover events to the underlying software and will only send the standard pointer events on click.

    ###### Returns

    false by default

  - ### getDragSpeed

    public float getDragSpeed(boolean yAxis)

    This method returns the dragging speed based on the latest dragged events

    ###### Parameters

    - `yAxis`: indicates what axis speed is required

    ###### Returns

    the dragging speed

  - ### isBidiAlgorithm

    public boolean isBidiAlgorithm()

    Indicates whether Codename One should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.

    ###### Returns

    true if the bidi algorithm should be considered

  - ### setBidiAlgorithm

    public void setBidiAlgorithm(boolean activate)

    Indicates whether Codename One should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.

    ###### Parameters

    - `activate`: @param activate set to true to activate the bidi algorithm, false to disable it

  - ### convertBidiLogicalToVisual

    public String convertBidiLogicalToVisual(String s)

    Converts the given string from logical bidi layout to visual bidi layout so it can be rendered properly on the screen. This method is only necessary for devices/platforms that don't have "built in" bidi support such as Sony Ericsson devices. See this for more on visual vs. logical ordering.

    ###### Parameters

    - `s`: a "logical" string with RTL characters

    ###### Returns

    a "visual" renderable string

  - ### getCharLocation

    public int getCharLocation(String source, int index)

    Returns the index of the given char within the source string, the actual index isn't necessarily the same when bidi is involved See this for more on visual vs. logical ordering.

    ###### Parameters

    - `source`: the string in which we are looking for the position

    - `index`: the "logical" location of the cursor

    ###### Returns

    the "visual" location of the cursor

  - ### isRTL

    public boolean isRTL(char c)

    Returns true if the given character is an RTL character

    ###### Parameters

    - `c`: character to test

    ###### Returns

    true if the charcter is an RTL character

  - ### getResourceAsStream

    public InputStream getResourceAsStream(Class cls, String resource)

    This method is essentially equivalent to cls.getResourceAsStream(String) however some platforms might define unique ways in which to load resources within the implementation.

    ###### Parameters

    - `cls`: class to load the resource from

    - `resource`: relative/absolute URL based on the Java convention

    ###### Returns

    input stream for the resource or null if not found

  - ### addEdtErrorHandler

    public void addEdtErrorHandler(ActionListener e)

    An error handler will receive an action event with the source exception from the EDT once an error handler is installed the default Codename One error dialog will no longer appear

    ###### Parameters

    - `e`: listener receiving the errors

  - ### removeEdtErrorHandler

    public void removeEdtErrorHandler(ActionListener e)

    An error handler will receive an action event with the source exception from the EDT once an error handler is installed the default Codename One error dialog will no longer appear

    ###### Parameters

    - `e`: listener receiving the errors

  - ### isAllowMinimizing

    public boolean isAllowMinimizing()

    Allows a Codename One application to minimize without forcing it to the front whenever a new dialog is poped up

    ###### Returns

    allowMinimizing value

  - ### setAllowMinimizing

    public void setAllowMinimizing(boolean allowMinimizing)

    Allows a Codename One application to minimize without forcing it to the front whenever a new dialog is poped up

    ###### Parameters

    - `allowMinimizing`: value

  - ### shouldRenderSelection

    public boolean shouldRenderSelection()

    This is an internal state flag relevant only for pureTouch mode (otherwise it will always be true). A pureTouch mode is stopped if a user switches to using the trackball/navigation pad and this flag essentially toggles between those two modes.

    ###### Returns

    the shouldRenderSelection

  - ### shouldRenderSelection

    public boolean shouldRenderSelection(Component c)

    This is an internal state flag relevant only for pureTouch mode (otherwise it will always be true). A pureTouch mode is stopped if a user switches to using the trackball/navigation pad and this flag essentially toggles between those two modes.

    ###### Parameters

    - `c`: the component to test against, this prevents a touch outside of the component that triggers a repaint from painting the component selection

    ###### Returns

    the shouldRenderSelection

  - ### isPureTouch

    public boolean isPureTouch()

    A pure touch device has no focus showing when the user is using the touch interface. Selection only shows when the user actually touches the screen or suddenly switches to using a keypad/trackball. This sort of interface is common in Android devices

    ###### Returns

    the pureTouch flag

  - ### setPureTouch

    public void setPureTouch(boolean pureTouch)

    A pure touch device has no focus showing when the user is using the touch interface. Selection only shows when the user actually touches the screen or suddenly switches to using a keypad/trackball. This sort of interface is common in Android devices

    ###### Parameters

    - `pureTouch`: the value for pureTouch

  - ### isNativeCommands

    public boolean isNativeCommands()

    Indicates whether Codename One commands should be mapped to the native menus

    ###### Returns

    the nativeCommands status

    ###### Deprecated

    use getCommandBehavior() == Display.COMMAND_BEHAVIOR_NATIVE

  - ### setNativeCommands

    public void setNativeCommands(boolean nativeCommands)

    Indicates whether Codename One commands should be mapped to the native menus

    ###### Parameters

    - `nativeCommands`: the flag to set

    ###### Deprecated

    use setCommandBehavior(Display.COMMAND_BEHAVIOR_NATIVE)

  - ### exitApplication

    public void exitApplication()
    Exits the application...

  - ### isFullScreenSupported

    public boolean isFullScreenSupported()

    Checks if this platform supports full-screen mode. If full-screen mode is supported, you can use the `#requestFullScreen()`, `#exitFullScreen()`, and `#isInFullScreenMode()` methods to enter and exit full-screen - and query the current state.

    Currently only desktop and Javascript builds support full-screen mode; And Javascript only supports this on certain browsers. See the MDN Fullscreen API docs for a list of browsers that support full-screen.

    When running in the simulator, full-screen is only supported for the desktop skin.

    ###### Returns

    true if Full-screen mode is supported on this platform.

    ###### Since

    6.0

    ###### See also

    - #requestFullScreen()

    - #exitFullScreen()

    - #isInFullScreenMode()

  - ### requestFullScreen

    public boolean requestFullScreen()

    Try to enter full-screen mode if the platform supports it.

    Currently only desktop and Javascript builds support full-screen mode; And Javascript only supports this on certain browsers. See the MDN Fullscreen API docs for a list of browsers that support full-screen.

    When running in the simulator, full-screen is only supported for the desktop skin.

    ###### Returns

    Returns:

      true on success. This will also return true if the app is already running in full-screen mode. It will return false if the app fails to enter full-screen mode.

      ###### Since

      6.0

      ###### See also

      - #exitFullScreen()

      - #isInFullScreenMode()

      - #isFullScreenSupported()

  - ### exitFullScreen

    public boolean exitFullScreen()

    Try to exit full-screen mode if the platform supports it.

    Currently only desktop and Javascript builds support full-screen mode; And Javascript only supports this on certain browsers. See the MDN Fullscreen API docs for a list of browsers that support full-screen.

    When running in the simulator, full-screen is only supported for the desktop skin.

    ###### Returns

    Returns:

      true on success. This will also return true if the app is already NOT in full-screen mode. It will return false if the app fails to exit full-screen mode.

      ###### Since

      6.0

      ###### See also

      - #requestFullScreen()

      - #isInFullScreenMode()

      - #isFullScreenSupported()

  - ### isInFullScreenMode

    public boolean isInFullScreenMode()

    Checks if the app is currently running in full-screen mode.

    ###### Returns

    true if the app is currently in full-screen mode.

    ###### Since

    6.0

    ###### See also

    - #requestFullScreen()

    - #exitFullScreen()

    - #isFullScreenSupported()

  - ### showNativeScreen

    public void showNativeScreen(Object nativeFullScreenPeer)

    Shows a native Form/Canvas or some other heavyweight native screen

    ###### Parameters

    - `nativeFullScreenPeer`: the native screen peer

  - ### isAutoFoldVKBOnFormSwitch

    public boolean isAutoFoldVKBOnFormSwitch()

    Normally Codename One folds the VKB when switching forms this field allows us to block that behavior.

    ###### Returns

    the autoFoldVKBOnFormSwitch

  - ### setAutoFoldVKBOnFormSwitch

    public void setAutoFoldVKBOnFormSwitch(boolean autoFoldVKBOnFormSwitch)

    Normally Codename One folds the VKB when switching forms this field allows us to block that behavior.

    ###### Parameters

    - `autoFoldVKBOnFormSwitch`: the autoFoldVKBOnFormSwitch to set

  - ### getCommandBehavior

    public int getCommandBehavior()

    Indicates the way commands should be added to a form as one of the ocmmand constants defined in this class

    ###### Returns

    the commandBehavior

    ###### Deprecated

  - ### setCommandBehavior

    public void setCommandBehavior(int commandBehavior)

    Indicates the way commands should be added to a form as one of the ocmmand constants defined in this class

    ###### Parameters

    - `commandBehavior`: the commandBehavior to set

    ###### Deprecated

  - ### postMessage

    public void postMessage(MessageEvent message)

    Posts a message to the native platform. Different platforms may handle messages posted this way differently.

    The Javascript port will dispatch the message on the window object as a custom DOM event named 'cn1outbox', with the event data containing a 'detail' key with the message, and a 'code' key with the code.

    ###### Parameters

    - `message`: The message.

    ###### Since

    7.0

  - ### addMessageListener

    public void addMessageListener(ActionListener<MessageEvent> l)

    Adds a listener to receive messages from the native platform. This is one mechanism for the native platform to communicate with the Codename one app.

    In the JavaScript port, listeners will be notified when DOM events named 'cn1inbox' are received on the window object. The event data 'detail' key will be the source of the message, and the 'code' key will be the source of the code.

    ###### Parameters

    - `l`: The listener.

    ###### Since

    7.0

  - ### removeMessageListener

    public void removeMessageListener(ActionListener<MessageEvent> l)

    Removes a listener from receiving messages from the native platform.

    ###### Parameters

    - `l`: The listener.

    ###### Since

    7.0

  - ### dispatchMessage

    public void dispatchMessage(MessageEvent evt)

    Dispatches a message to all of the registered listeners.

    ###### Parameters

    - `evt`

    ###### Since

    7.0

    ###### See also

    - #addMessageListener(com.codename1.ui.events.ActionListener)

    - #removeMessageListener(com.codename1.ui.events.ActionListener)

  - ### addWindowListener

    public void addWindowListener(ActionListener<WindowEvent> l)

    Adds a listener to receive notifications about native window changes such as resize or movement.

    ###### Parameters

    - `l`: the listener to add

  - ### removeWindowListener

    public void removeWindowListener(ActionListener<WindowEvent> l)

    Removes a previously registered window listener.

    ###### Parameters

    - `l`: the listener to remove

  - ### fireWindowEvent

    public void fireWindowEvent(WindowEvent evt)

    Dispatches a window change event to registered listeners. This method is intended to be invoked by platform implementations.

    ###### Parameters

    - `evt`: the window event to dispatch

  - ### getProperty

    public String getProperty(String key, String defaultValue)

    Returns the property from the underlying platform deployment or the default value if no deployment values are supported. This is equivalent to the getAppProperty from the jad file.

    The implementation should be responsible for the following keys to return reasonable valid values for the application:

    - AppName

    - User-Agent

    - AppVersion

    - Platform - Similar to microedition.platform

    - OS - returns what is the underlying platform e.g. - iOS, Android, RIM, SE...

    - OSVer - OS version when available as a user readable string (not necessarily a number e.g: 3.2.1).

    ###### Parameters

    - `key`: the key of the property

    - `defaultValue`: a default return value

    ###### Returns

    the value of the property

  - ### setProperty

    public void setProperty(String key, String value)

    Sets a local property to the application, this method has no effect on the implementation code and only allows the user to override the logic of getProperty for internal application purposes.

    ###### Parameters

    - `key`: key the key of the property

    - `value`: the value of the property

  - ### canExecute

    public Boolean canExecute(String url)

    Returns true if executing this URL should work, returns false if it will not and null if this is unknown.

        Boolean can = Display.getInstance().canExecute("imdb:///find?q=godfather");
        if(can != null && can) {
          Display.getInstance().execute("imdb:///find?q=godfather");
        } else {
          Display.getInstance().execute("http://www.imdb.com");
        }

    ###### Parameters

    - `url`: the url that would be executed

    ###### Returns

    Returns:
      true if executing this URL should work, returns false if it will not and null if this is unknown

  - ### execute

    public void execute(String url)

    Executes the given URL on the native platform.

        Boolean can = Display.getInstance().canExecute("imdb:///find?q=godfather");
        if(can != null && can) {
          Display.getInstance().execute("imdb:///find?q=godfather");
        } else {
          Display.getInstance().execute("http://www.imdb.com");
        }

    On the JavaSE simulator this method also serves as the cross-platform entry point for the simulator hook system. The simulator scans cn1libs (and the running app) for `META-INF/codenameone/simulator-hooks.properties` files, and a URL of the form `namespace:itemN` that matches a registered hook is intercepted and dispatched on the CN1 EDT instead of being handed to the native URL opener. On Android, iOS, JavaScript and other production targets no hooks are ever registered, so a hook-style URL falls through to the normal native execute and (almost always) becomes a no-op. CN1 UnitTests running cross-platform should guard with `canExecute(String)` before invoking a hook URL:

        if (Boolean.TRUE.equals(Display.getInstance().canExecute("bluetooth:item1"))) {
            Display.getInstance().execute("bluetooth:item1"); // toggle the simulated adapter
        }

    See the developer guide's "Creating CN1Libs" chapter for the `simulator-hooks.properties` format and the positional `itemN` / `labelN` conventions.

    ###### Parameters

    - `url`: the url to execute

  - ### execute

    public void execute(String url, ActionListener response)

    Executes the given URL on the native platform, this method is useful if the platform has the ability to send an event to the app when the execution has ended, currently this works only for Android platform to invoke other intents.

    ###### Parameters

    - `url`: the url to execute

    - `response`: @param response a callback from the platform when this execution returned to the application

  - ### getDeviceDensity

    public int getDeviceDensity()

    Returns one of the density variables appropriate for this device, notice that density doesn't always correspond to resolution and an implementation might decide to change the density based on DPI constraints.

    ###### Returns

    one of the DENSITY constants of Display

  - ### getDensityStr

    public String getDensityStr()

    Returns the device density as a string.

    - DENSITY_VERY_LOW : "very-low"

    - DENSITY_LOW : "low"

    - DENSITY_MEDIUM : "medium"

    - DENSITY_HIGH : "high"

    - DENSITY_VERY_HIGH : "very-high"

    - DENSITY_HD : "hd"

    - DENSITY_560 : "560"

    - DENSITY_2HD : "2hd"

    - DENSITY_4K : "4k";

    ###### Returns

    Device density as a string.

    ###### Since

    7.0

    ###### See also

    - #getDeviceDensity()

  - ### playBuiltinSound

    public void playBuiltinSound(String soundIdentifier)

    Plays a builtin device sound matching the given identifier, implementations and themes can offer additional identifiers to the ones that are already built in.

    ###### Parameters

    - `soundIdentifier`: @param soundIdentifier the sound identifier which can match one of the common constants in this class or be a user/implementation defined sound

    ###### Deprecated

    this isn't supported on most platforms

  - ### getDisplaySafeArea

    public Rectangle getDisplaySafeArea(Rectangle rect)

    Gets the display safe area as a rectangle.

    ###### Parameters

    - `rect`: Out parameter that will store the display safe area.

    ###### Returns

    The display safe area.

    ###### Since

    7.0

    ###### See also

    - Form#getSafeArea()

  - ### installBuiltinSound

    public void installBuiltinSound(String soundIdentifier, InputStream data) throws IOException

    Installs a replacement sound as the builtin sound responsible for the given sound identifier (this will override the system sound if such a sound exists).

    ###### Parameters

    - `soundIdentifier`: the sound string passed to playBuiltinSound

    - `data`: @param data an input stream containing platform specific audio file, its usually safe to assume that wav/mp3 would be supported.

    ###### Throws

    - `IOException`: if the stream throws an exception
    Throws:
      `IOException`

  - ### isBuiltinSoundAvailable

    public boolean isBuiltinSoundAvailable(String soundIdentifier)

    Indicates whether a user installed or system sound is available

    ###### Parameters

    - `soundIdentifier`: the sound string passed to playBuiltinSound

    ###### Returns

    true if a sound of this given type is avilable

    ###### Deprecated

    this isn't supported on most platforms

  - ### isBuiltinSoundsEnabled

    public boolean isBuiltinSoundsEnabled()

    Allows muting/unmuting the builtin sounds easily

    ###### Returns

    true if the sound is not muted

  - ### setBuiltinSoundsEnabled

    public void setBuiltinSoundsEnabled(boolean enabled)

    Allows muting/unmuting the builtin sounds easily

    ###### Parameters

    - `enabled`: indicates whether the sound is muted

  - ### createMedia

    public Media createMedia(String uri, boolean isVideo, Runnable onCompletion) throws IOException

    Creates a sound in the given URI which is partially platform specific. Notice that an audio is "auto destroyed" on completion and cannot be played twice!

    ###### Parameters

    - `uri`: the platform specific location for the sound

    - `onCompletion`: invoked when the audio file finishes playing, may be null

    ###### Returns

    a handle that can be used to control the playback of the audio

    ###### Throws

    - `java.io.IOException`: if the URI access fails
    Throws:
      `IOException`

  - ### createMediaAsync

    public AsyncResource<Media> createMediaAsync(String uri, boolean video, Runnable onCompletion)

    Creates media asynchronously.

    ###### Parameters

    - `uri`: the platform specific location for the sound

    - `onCompletion`: invoked when the audio file finishes playing, may be null

    ###### Returns

    a handle that can be used to control the playback of the audio

    ###### Since

    7.0

  - ### addCompletionHandler

    public void addCompletionHandler(Media media, Runnable onCompletion)

    Adds a callback to a Media element that will be called when the media finishes playing.

    ###### Parameters

    - `media`: The media to add the callback to.

    - `onCompletion`: The callback that will run on the EDT when the playback completes.

    ###### See also

    - #removeCompletionHandler(com.codename1.media.Media, java.lang.Runnable)

  - ### removeCompletionHandler

    public void removeCompletionHandler(Media media, Runnable onCompletion)

    Removes onComplete callback from Media element.

    ###### Parameters

    - `media`: The media element.

    - `onCompletion`: The callback.

    ###### See also

    - #addCompletionHandler(com.codename1.media.Media, java.lang.Runnable)

  - ### createMedia

    public Media createMedia(InputStream stream, String mimeType, Runnable onCompletion) throws IOException

    Create the sound in the given stream Notice that an audio is "auto destroyed" on completion and cannot be played twice!

    ###### Parameters

    - `stream`: the stream containing the media data

    - `mimeType`: the type of the data in the stream

    - `onCompletion`: invoked when the audio file finishes playing, may be null

    ###### Returns

    a handle that can be used to control the playback of the audio

    ###### Throws

    - `java.io.IOException`: if the URI access fails
    Throws:
      `IOException`

  - ### createMediaAsync

    public AsyncResource<Media> createMediaAsync(InputStream stream, String mimeType, Runnable onCompletion)

  - ### createSoftWeakRef

    public Object createSoftWeakRef(Object o)

    Creates a soft/weak reference to an object that allows it to be collected yet caches it. This method is in the porting layer since CLDC only includes weak references while some platforms include nothing at all and some include the superior soft references.

    ###### Parameters

    - `o`: object to cache

    ###### Returns

    a caching object or null if caching isn't supported

  - ### extractHardRef

    public Object extractHardRef(Object o)

    Extracts the hard reference from the soft/weak reference given

    ###### Parameters

    - `o`: the reference returned by createSoftWeakRef

    ###### Returns

    the original object submitted or null

  - ### hasNativeTheme

    public boolean hasNativeTheme()

    Indicates if the implemenetation has a native underlying theme

    ###### Returns

    true if the implementation has a native theme available

  - ### installNativeTheme

    public void installNativeTheme()
    Installs the native theme, this is only applicable if hasNativeTheme() returned true. Notice that this method might replace the DefaultLookAndFeel instance and the default transitions.

  - ### copyToClipboard

    public void copyToClipboard(Object obj)

    Performs a clipboard copy operation, if the native clipboard is supported by the implementation it would be used

    ###### Parameters

    - `obj`: @param obj object to copy, while this can be any arbitrary object it is recommended that only Strings or Codename One image objects be used to copy

  - ### getPasteDataFromClipboard

    public Object getPasteDataFromClipboard()

    Returns the current content of the clipboard

    ###### Returns

    can be any object or null see copyToClipboard

  - ### isPortrait

    public boolean isPortrait()

    Returns true if the device is currently in portrait mode

    ###### Returns

    true if the device is in portrait mode

  - ### isLockOrientation

    public boolean isLockOrientation()

    Returns true if orientation was locked using #lockOrientation(boolean) and not yet unlocked via #unlockOrientation().

    ###### Returns

    true if orientation is currently marked as locked

  - ### canForceOrientation

    public boolean canForceOrientation()

    Returns true if the device allows forcing the orientation via code, feature phones do not allow this although some include a jad property allowing for this feature

    Since version 6.0, orientation lock is supported in Javascript builds in some browsers. For a full list of browsers the support locking orientation, see the MDN Lock Orientation docs.

    NOTE: In Javascript builds, orientation lock is only supported if the app is running in full-screen mode. If the app is not currently in full-screen mode, then `#canForceOrientation()` will return false and `#lockOrientation(boolean)` will do nothing.

    ###### Returns

    true if lockOrientation would work

    ###### See also

    - #lockOrientation(boolean)

    - #unlockOrientation()

  - ### lockOrientation

    public void lockOrientation(boolean portrait)

    On devices that return true for canForceOrientation() this method can lock the device orientation either to portrait or landscape mode

    Since version 6.0, orientation lock is supported in Javascript builds in some browsers. For a full list of browsers the support locking orientation, see the MDN Lock Orientation docs.

    NOTE: In Javascript builds, orientation lock is only supported if the app is running in full-screen mode. If the app is not currently in full-screen mode, then `#canForceOrientation()` will return false and `#lockOrientation(boolean)` will do nothing.

    ###### Parameters

    - `portrait`: true to lock to portrait mode, false to lock to landscape mode

    ###### See also

    - #unlockOrientation()

    - #canForceOrientation()

  - ### unlockOrientation

    public void unlockOrientation()

    This is the reverse method for lock orientation allowing orientation lock to be disabled

    Since version 6.0, orientation lock is supported in Javascript builds in some browsers. For a full list of browsers the support locking orientation, see the MDN Lock Orientation docs.

    NOTE: In Javascript builds, orientation lock is only supported if the app is running in full-screen mode. If the app is not currently in full-screen mode, then `#canForceOrientation()` will return false and `#lockOrientation(boolean)` will do nothing.

    ###### See also

    - #lockOrientation(boolean)

    - #canForceOrientation()

  - ### isTablet

    public boolean isTablet()

    Indicates whether the device is a tablet, notice that this is often a guess

    ###### Returns

    true if the device is assumed to be a tablet

  - ### isDesktop

    public boolean isDesktop()

    Returns true if this is a desktop application

    ###### Returns

    true if this is a desktop application

  - ### canDial

    public boolean canDial()

    Returns true if the device has dialing capabilities

    ###### Returns

    false if it cannot dial

  - ### areMutableImagesFast

    public boolean areMutableImagesFast()

    On most platforms it is quite fast to draw on a mutable image and then render that image, however some platforms have much slower mutable images in comparison to just drawing on the screen. These platforms should return false here and Codename One will try to use less mutable image related optimizations in transitions and other operations.

    ###### Returns

    true if mutable images are fast on this platform

  - ### getLocationManager

    public LocationManager getLocationManager()

    This method returns the platform Location Manager used for geofencing. This allows tracking the user location in the background. Usage:

        // File: BGLocationTest.java
        public void showForm() {
            Form hi = new Form("Hi World");
            hi.addComponent(new Label("Hi World"));

            Location loc = new Location();
            loc.setLatitude(51.5033630);
            loc.setLongitude(-0.1276250);

            Geofence gf = new Geofence("test", loc, 100, 100000);

            LocationManager.getLocationManager().addGeoFencing(GeofenceListenerImpl.class, gf);

            hi.show();
        }

        // File: GeofenceListenerImpl.java
        public class GeofenceListenerImpl implements GeofenceListener {
            public void onExit(String id) {
                System.out.println("Exited "+id);
            }

            public void onEntered(String id) {
                System.out.println("Entered "+id);
            }
        }

        `public class GeofenceListenerImpl implements GeofenceListener {
        public void onExit(String id) {
        System.out.println("Exited "+id);`

        public void onEntered(String id) {
        System.out.println("Entered "+id);
        }
        }
        Form hi = new Form("Hi World");
        hi.addComponent(new Label("Hi World"));

        Location loc = new Location();
        loc.setLatitude(51.5033630);
        loc.setLongitude(-0.1276250);

        Geofence gf = new Geofence("test", loc, 100, 100000);

        LocationManager.getLocationManager().addGeoFencing(GeofenceListenerImpl.class, gf);

        hi.show();}

    ###### Returns

    LocationManager Object

  - ### getBiometrics

    public Biometrics getBiometrics()
    Returns the platform biometric authentication entry point. Prefer `Biometrics.getInstance()` in application code --- it handles the fallback to a no-op stub when the current port does not implement biometrics.

  - ### getSecureStorage

    public SecureStorage getSecureStorage()
    Returns the platform biometric-gated secure storage. Prefer `SecureStorage.getInstance()` in application code.

  - ### getNfc

    public Nfc getNfc()
    Returns the platform NFC entry point. Prefer `Nfc.getInstance()` in application code --- it handles the fallback to a no-op stub when the current port does not implement NFC.

  - ### capturePhoto

    public void capturePhoto(ActionListener response)

    This method tries to invoke the device native camera to capture images. The method returns immediately and the response will be sent asynchronously to the given ActionListener Object The image is saved as a jpeg to a file on the device.

    use this in the actionPerformed to retrieve the file path String path = (String) evt.getSource();

    if evt returns null the image capture was cancelled by the user.

    ###### Parameters

    - `response`: a callback Object to retrieve the file path

    ###### Throws

    - `RuntimeException`: if this feature failed or unsupported on the platform

  - ### captureAudio

    public void captureAudio(ActionListener<ActionEvent> response)

    This method tries to invoke the device native hardware to capture audio. The method returns immediately and the response will be sent asynchronously to the given ActionListener Object The audio is saved to a file on the device.

    use this in the actionPerformed to retrieve the file path String path = (String) evt.getSource();

    ###### Parameters

    - `response`: a callback Object to retrieve the file path

    ###### Throws

    - `RuntimeException`: if this feature failed or unsupported on the platform

  - ### captureAudio

    public void captureAudio(MediaRecorderBuilder recordingOptions, ActionListener response)

    This method tries to invoke the device native hardware to capture audio. The method returns immediately and the response will be sent asynchronously to the given ActionListener Object The audio is saved to a file on the device.

    use this in the actionPerformed to retrieve the file path String path = (String) evt.getSource();

    ###### Parameters

    - `recordingOptions`: Audio recording options.

    - `response`: a callback Object to retrieve the file path

    ###### Throws

    - `RuntimeException`: if this feature failed or unsupported on the platform

    ###### Since

    7.0

  - ### captureVideo

    public void captureVideo(ActionListener response)

    This method tries to invoke the device native camera to capture video. The method returns immediately and the response will be sent asynchronously to the given ActionListener Object The video is saved to a file on the device.

    use this in the actionPerformed to retrieve the file path String path = (String) evt.getSource();

    ###### Parameters

    - `response`: a callback Object to retrieve the file path

    ###### Throws

    - `RuntimeException`: if this feature failed or unsupported on the platform

  - ### captureVideo

    public void captureVideo(VideoCaptureConstraints constraints, ActionListener response)

    Same as `#captureVideo(com.codename1.ui.events.ActionListener)`, except that it attempts to impose constraints on the capture. Constraints include width, height, and max length. Not all platforms support capture constraints. Use the `VideoCaptureConstraints#isSupported()` to see if a constraint is supported. If constraints are not supported at all, then this method will fall back to calling `#captureVideo(com.codename1.ui.events.ActionListener)`.

    ###### Parameters

    - `constraints`: Capture constraints to use.

    - `response`: a callback Object to retrieve the file path

    ###### Since

    7.0

    ###### See also

    - com.codename1.capture.Capture#captureVideo(com.codename1.capture.VideoCaptureConstraints, com.codename1.ui.events.ActionListener)

  - ### openImageGallery

    public void openImageGallery(ActionListener response)

    Opens the device image gallery The method returns immediately and the response will be sent asynchronously to the given ActionListener Object

    use this in the actionPerformed to retrieve the file path String path = (String) evt.getSource();

    ###### Parameters

    - `response`: a callback Object to retrieve the file path

    ###### Throws

    - `RuntimeException`: if this feature failed or unsupported on the platform

    ###### Deprecated

    see openGallery instead

  - ### openGallery

    public void openGallery(ActionListener response, int type)

    Opens the device gallery to pick an image or a video.

    The method returns immediately and the response is sent asynchronously to the given ActionListener Object as the source value of the event (as a String)

    E.g. within the callback action performed call you can use this code: `String path = (String) evt.getSource();`.

    A more detailed sample of picking a video file can be seen here:

        final Form hi = new Form("MediaPlayer", new BorderLayout());
        hi.setToolbar(new Toolbar());
        Style s = UIManager.getInstance().getComponentStyle("Title");
        FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_VIDEO_LIBRARY, s);
        hi.getToolbar().addCommandToRightBar(new Command("", icon) {
        @Override
            public void actionPerformed(ActionEvent evt) {
                Display.getInstance().openGallery((e) -> {
                    if(e != null && e.getSource() != null) {
                        String file = (String)e.getSource();
                        try {
                            Media video = MediaManager.createMedia(file, true);
                            hi.removeAll();
                            hi.add(BorderLayout.CENTER, new MediaPlayer(video));
                            hi.revalidate();
                        } catch(IOException err) {
                            Log.e(err);
                        }
                    }
                }, Display.GALLERY_VIDEO);
            }
        });
        hi.show();

    Version 5.0 and higher support multi-selection (i.e. the types `#GALLERY_IMAGE_MULTI`, `#GALLERY_VIDEO_MULTI`, and `#GALLERY_ALL_MULTI`). When using one of the multiselection types, the source of the ActionEvent will be a `String[]`, containing the paths of the selected elements, or null if the user cancelled the dialog.

    Platform support

    Currently (version 5.0 and higher), all platforms support the types `#GALLERY_IMAGE`, `#GALLERY_VIDEO`, `#GALLERY_ALL`, `#GALLERY_IMAGE_MULTI`, `#GALLERY_VIDEO_MULTI`, `#GALLERY_ALL_MULTI`. On iOS, multi-selection requires a deployment target of iOS 8.0 or higher, so it is disabled by default. You can enable multi-selection on iOS, by adding the ios.enableGalleryMultiselect=true build hint. This build hint will be added automatically for you if you run your app in the simulator, and it calls openGallery() with one of the multiselect gallery types.

    ###### Parameters

    - `response`: @param response a callback Object to retrieve the file path For multiselection types (`#GALLERY_IMAGE_MULTI`, `#GALLERY_VIDEO_MULTI`, and `#GALLERY_ALL_MULTI`), the source of the ActionEvent sent this callback will be a String[]. For other types, it will be a String. If the dialog was cancelled, it will be null.

    - `type`: one of the following `#GALLERY_IMAGE`, `#GALLERY_VIDEO`, `#GALLERY_ALL`, `#GALLERY_IMAGE_MULTI`, `#GALLERY_VIDEO_MULTI`, `#GALLERY_ALL_MULTI`.

    ###### Throws

    - `RuntimeException`: if this feature failed or unsupported on the platform. Use `#isGalleryTypeSupported(int)` to check if the type is supported before calling this method.

    ###### See also

    - #isGalleryTypeSupported(int) To see if a type is supported on the current platform.

  - ### isGalleryTypeSupported

    public boolean isGalleryTypeSupported(int type)

    Checks to see if the given gallery type is supported on the current platform.

    ###### Parameters

    - `type`: one of the following `#GALLERY_IMAGE`, `#GALLERY_VIDEO`, `#GALLERY_ALL`, `#GALLERY_IMAGE_MULTI`, `#GALLERY_VIDEO_MULTI`, `#GALLERY_ALL_MULTI`.

    ###### Returns

    True if the type is supported

    ###### See also

    - #openGallery(com.codename1.ui.events.ActionListener, int)

  - ### getPlatformName

    public String getPlatformName()

    Returns a 2-3 letter code representing the platform name for the platform override

    ###### Returns

    the name of the platform e.g. ios, rim, win, and, me, HTML5

  - ### getPlatformOverrides

    public String[] getPlatformOverrides()

    Returns the suffixes for ovr files that should be used when loading a layered resource file on this platform

    ###### Returns

    a string array with the proper order of resource override layers

  - ### sendMessage

    public void sendMessage(String[] recipients, String subject, Message msg)

    Send an email using the platform mail client.

    The code below demonstrates sending a simple message with attachments using the devices native email client:

        Message m = new Message("Body of message");
        m.getAttachments().put(textAttachmentUri, "text/plain");
        m.getAttachments().put(imageAttachmentUri, "image/png");
        Display.getInstance().sendMessage(new String[] {"someone@gmail.com"}, "Subject of message", m);

    ###### Parameters

    - `recipients`: array of e-mail addresses

    - `subject`: e-mail subject

    - `msg`: the Message to send

  - ### dial

    public void dial(String phoneNumber)

    Opens the device Dialer application with the given phone number

    ###### Parameters

    - `phoneNumber`

  - ### isCallDetectionSupported

    public boolean isCallDetectionSupported()

    Indicates whether this platform can attempt to detect active phone-call interruptions.

    A `true` result means the platform provides a best-effort heuristic only. It does not guarantee exact telephony state.

    ###### Returns

    `true` if call detection is implemented on this platform.

  - ### isInCall

    public boolean isInCall()

    Best-effort check for whether the platform currently believes an active phone call is interrupting the app.

    This API is intentionally heuristic. It can produce false positives (e.g. non-call interruptions like Control Center or app-switching) and false negatives. Use it for UX hints and telemetry, not as a security or business-critical gate.

    ###### Returns

    `true` if the platform currently believes a call interruption is active.

  - ### getSMSSupport

    public int getSMSSupport()

    Indicates the level of SMS support in the platform as one of: `#SMS_NOT_SUPPORTED` (for desktop, tablet etc.), `#SMS_SEAMLESS` (no UI interaction), `#SMS_INTERACTIVE` (with compose UI), `#SMS_BOTH`.

    The sample below demonstrates the use case for this property:

        void sendMessage(String phone, String data) {
            switch(Display.getInstance().getSMSSupport()) {
            case Display.SMS_NOT_SUPPORTED:
                return;
            case Display.SMS_SEAMLESS:
                showUIDialogToEditMessageData();
                Display.getInstance().sendSMS(phone, data);
                return;
            default:
                Display.getInstance().sendSMS(phone, data);
                return;
            }
        }

    ###### Returns

    one of the SMS_* values

  - ### sendSMS

    public void sendSMS(String phoneNumber, String message) throws IOException

    Sends a SMS message to the given phone number

    ###### Parameters

    - `phoneNumber`: to send the sms

    - `message`: the content of the sms

    Throws:
      `IOException`

  - ### sendSMS

    public void sendSMS(String phoneNumber, String message, boolean interactive) throws IOException

    Sends a SMS message to the given phone number, the code below demonstrates the logic of detecting platform behavior for sending SMS.

        void sendMessage(String phone, String data) {
            switch(Display.getInstance().getSMSSupport()) {
            case Display.SMS_NOT_SUPPORTED:
                return;
            case Display.SMS_SEAMLESS:
                showUIDialogToEditMessageData();
                Display.getInstance().sendSMS(phone, data);
                return;
            default:
                Display.getInstance().sendSMS(phone, data);
                return;
            }
        }

    ###### Parameters

    - `phoneNumber`: to send the sms

    - `message`: the content of the sms

    - `interactive`: indicates the SMS should show a UI or should not show a UI if applicable see getSMSSupport

    ###### See also

    - #getSMSSupport()
    Throws:
      `IOException`

  - ### notifyStatusBar

    public void notifyStatusBar(String tickerText, String contentTitle, String contentBody, boolean vibrate, boolean flashLights)

    Place a notification on the device status bar (if device has this functionality). Clicking the notification might re-start the Application.

    ###### Parameters

    - `tickerText`: the ticker text of the Notification

    - `contentTitle`: the title of the Notification

    - `contentBody`: the content of the Notification

    - `vibrate`: enable/disable notification alert

    - `flashLights`: enable/disable notification flashing

    ###### Deprecated

  - ### isNotificationSupported

    public boolean isNotificationSupported()

    Indicates whether the notify status bar method will present a notification to the user

    ###### Returns

    true if the notify status bar method will present a notification to the user

  - ### notifyStatusBar

    public Object notifyStatusBar(String tickerText, String contentTitle, String contentBody, boolean vibrate, boolean flashLights, Hashtable args)

    Place a notification on the device status bar (if device has this functionality). Clicking the notification might re-start the Application.

    ###### Parameters

    - `tickerText`: the ticker text of the Notification

    - `contentTitle`: the title of the Notification

    - `contentBody`: the content of the Notification

    - `vibrate`: enable/disable notification alert

    - `flashLights`: enable/disable notification flashing

    - `args`: additional arguments to the notification

    ###### Returns

    a platform native object that allows modifying notification state

    ###### Deprecated

    use scheduleLocalNotification instead

  - ### dismissNotification

    public void dismissNotification(Object o)

    Removes the notification previously posted with the notify status bar method

    ###### Parameters

    - `o`: the object returned from the notifyStatusBar method

  - ### isBadgingSupported

    public boolean isBadgingSupported()

    Returns true if the underlying OS supports numeric badges on icons. Notice this is only available on iOS and only when push notification is enabled

    ###### Returns

    true if the underlying OS supports numeric badges

  - ### setBadgeNumber

    public void setBadgeNumber(int number)

    Sets the number that appears on the application icon in iOS

    ###### Parameters

    - `number`: number to show on the icon

  - ### isOpenNativeNavigationAppSupported

    public boolean isOpenNativeNavigationAppSupported()

    Returns true if the underlying OS supports opening the native navigation application

    ###### Returns

    true if the underlying OS supports launch of native navigation app

  - ### openNativeNavigationApp

    public void openNativeNavigationApp(double latitude, double longitude)

    Opens the native navigation app in the given coordinate.

    ###### Parameters

    - `latitude`

    - `longitude`

  - ### openNativeNavigationApp

    public void openNativeNavigationApp(String location)

    Opens the native navigation app with the given search location

    ###### Parameters

    - `location`: the location to search for in the native navigation map

  - ### getAllContacts

    public String[] getAllContacts(boolean withNumbers)

    Gets all contacts from the address book of the device

    ###### Parameters

    - `withNumbers`: if true returns only contacts that has a number

    ###### Returns

    array of contacts unique ids

  - ### getAllContacts

    public Contact[] getAllContacts(boolean withNumbers, boolean includesFullName, boolean includesPicture, boolean includesNumbers, boolean includesEmail, boolean includeAddress)

    Notice: this method might be very slow and should be invoked on a separate thread! It might have platform specific optimizations over getAllContacts followed by looping over individual contacts but that isn't guaranteed. See isGetAllContactsFast for information.

    The sample below demonstrates listing all the contacts within the device with their photos

        Form hi = new Form("Contacts", new BoxLayout(BoxLayout.Y_AXIS));
        hi.add(new InfiniteProgress());
        int size = Display.getInstance().convertToPixels(5, true);
        FontImage fi = FontImage.createFixed("" + FontImage.MATERIAL_PERSON, FontImage.getMaterialDesignFont(), 0xff, size, size);

        Display.getInstance().scheduleBackgroundTask(() -> {
            Contact[] contacts = Display.getInstance().getAllContacts(true, true, false, true, false, false);
            Display.getInstance().callSerially(() -> {
                hi.removeAll();
                for(Contact c : contacts) {
                    MultiButton mb = new MultiButton(c.getDisplayName());
                    mb.setIcon(fi);
                    mb.setTextLine2(c.getPrimaryPhoneNumber());
                    hi.add(mb);
                    mb.putClientProperty("id", c.getId());
                    Display.getInstance().scheduleBackgroundTask(() -> {
                        Contact cc = ContactsManager.getContactById(c.getId(), false, true, false, false, false);
                        Display.getInstance().callSerially(() -> {
                            Image photo = cc.getPhoto();
                            if(photo != null) {
                                mb.setIcon(photo.fill(size, size));
                                mb.revalidate();
                            }
                        });
                    });
                }
                hi.getContentPane().animateLayout(150);
            });
        });

    ###### Parameters

    - `withNumbers`: if true returns only contacts that has a number

    - `includesFullName`: if true try to fetch the full name of the Contact(not just display name)

    - `includesPicture`: if true try to fetch the Contact Picture if exists

    - `includesNumbers`: if true try to fetch all Contact numbers

    - `includesEmail`: if true try to fetch all Contact Emails

    - `includeAddress`: if true try to fetch all Contact Addresses

    ###### Returns

    array of the contacts

  - ### isGetAllContactsFast

    public boolean isGetAllContactsFast()

    Indicates if the getAllContacts is platform optimized, notice that the method might still take seconds or more to run so you should still use a separate thread!

    ###### Returns

    true if getAllContacts will perform faster that just getting each contact

  - ### getLinkedContactIds

    public String[] getLinkedContactIds(Contact c)

    Gets IDs of all contacts that are linked to a given contact. Some platforms, like iOS, allow for multiple distinct contact records to be "linked" to indicate that they refer to the same person.

    ###### Parameters

    - `c`: The contact whose "linked" contacts are to be retrieved.

    ###### Returns

    IDs of linked contacts.

  - ### getContactById

    public Contact getContactById(String id)

    Get a Contact according to it's contact id.

    ###### Parameters

    - `id`: unique id of the Contact

    ###### Returns

    a Contact Object

  - ### getContactById

    public Contact getContactById(String id, boolean includesFullName, boolean includesPicture, boolean includesNumbers, boolean includesEmail, boolean includeAddress)

    This method returns a Contact by the contact id and fills it's data according to the given flags.

    The sample below demonstrates listing all the contacts within the device with their photos

        Form hi = new Form("Contacts", new BoxLayout(BoxLayout.Y_AXIS));
        hi.add(new InfiniteProgress());
        int size = Display.getInstance().convertToPixels(5, true);
        FontImage fi = FontImage.createFixed("" + FontImage.MATERIAL_PERSON, FontImage.getMaterialDesignFont(), 0xff, size, size);

        Display.getInstance().scheduleBackgroundTask(() -> {
            Contact[] contacts = Display.getInstance().getAllContacts(true, true, false, true, false, false);
            Display.getInstance().callSerially(() -> {
                hi.removeAll();
                for(Contact c : contacts) {
                    MultiButton mb = new MultiButton(c.getDisplayName());
                    mb.setIcon(fi);
                    mb.setTextLine2(c.getPrimaryPhoneNumber());
                    hi.add(mb);
                    mb.putClientProperty("id", c.getId());
                    Display.getInstance().scheduleBackgroundTask(() -> {
                        Contact cc = ContactsManager.getContactById(c.getId(), false, true, false, false, false);
                        Display.getInstance().callSerially(() -> {
                            Image photo = cc.getPhoto();
                            if(photo != null) {
                                mb.setIcon(photo.fill(size, size));
                                mb.revalidate();
                            }
                        });
                    });
                }
                hi.getContentPane().animateLayout(150);
            });
        });

    ###### Parameters

    - `id`: of the Contact

    - `includesFullName`: if true try to fetch the full name of the Contact(not just display name)

    - `includesPicture`: if true try to fetch the Contact Picture if exists

    - `includesNumbers`: if true try to fetch all Contact numbers

    - `includesEmail`: if true try to fetch all Contact Emails

    - `includeAddress`: if true try to fetch all Contact Addresses

    ###### Returns

    a Contact Object

  - ### isContactsPermissionGranted

    public boolean isContactsPermissionGranted()

    Some platforms allow the user to block contacts access on a per application basis this method returns true if the user denied permission to access contacts. This can allow you to customize the error message presented to the user.

    ###### Returns

    true if contacts access is allowed or globally available, false otherwise

  - ### createContact

    public String createContact(String firstName, String familyName, String officePhone, String homePhone, String cellPhone, String email)

    Create a contact to the device contacts book

    ###### Parameters

    - `firstName`: the Contact firstName

    - `familyName`: the Contact familyName

    - `officePhone`: the Contact work phone or null

    - `homePhone`: the Contact home phone or null

    - `cellPhone`: the Contact mobile phone or null

    - `email`: the Contact email or null

    ###### Returns

    the contact id if creation succeeded or null if failed

  - ### deleteContact

    public boolean deleteContact(String id)

    removed a contact from the device contacts book

    ###### Parameters

    - `id`: the contact id to remove

    ###### Returns

    true if deletion succeeded false otherwise

  - ### isNativeVideoPlayerControlsIncluded

    public boolean isNativeVideoPlayerControlsIncluded()

    Indicates if the native video player includes its own play/pause etc. controls so the movie player component doesn't need to include them

    ###### Returns

    true if the movie player component doesn't need to include such controls

  - ### isNativeShareSupported

    public boolean isNativeShareSupported()

    Indicates if the underlying platform supports sharing capabilities

    ###### Returns

    true if the underlying platform handles share.

  - ### share

    public void share(String toShare)

    Share the required information using the platform sharing services. a Sharing service can be: mail, sms, facebook, twitter,... This method is implemented if isNativeShareSupported() returned true for a specific platform.

    Since 6.0, there is native sharing support in the Javascript port using the navigator.share API. Currently (2019) this is only supported on Chrome for Android, and will only work if the app is accessed over https:.

    ###### Parameters

    - `toShare`: String to share.

    ###### Deprecated

    use the method share that accepts an image and mime type

  - ### share

    public void share(String text, String image, String mimeType)

    Share the required information using the platform sharing services. a Sharing service can be: mail, sms, facebook, twitter,... This method is implemented if isNativeShareSupported() returned true for a specific platform.

    Since 6.0, there is native sharing support in the Javascript port using the navigator.share API. Currently (2019) this is only supported on Chrome for Android, and will only work if the app is accessed over https:.

    ###### Parameters

    - `text`: String to share.

    - `image`: file path to the image or null

    - `mimeType`: type of the image or null if no image to share

  - ### share

    public void share(String textOrPath, String image, String mimeType, Rectangle sourceRect)

    Share the required information using the platform sharing services. a Sharing service can be: mail, sms, facebook, twitter,... This method is implemented if isNativeShareSupported() returned true for a specific platform.

    Since 6.0, there is native sharing support in the Javascript port using the navigator.share API. Currently (2019) this is only supported on Chrome for Android, and will only work if the app is accessed over https:.

    Since 8.0, you can share files using using the file path in the text parameter. The file must exist in file system storage, and you must define the appropriate mimeType in the mimeType parameter. E.g. `share("file:/.../myfile.pdf", null, "application.pdf")`

    ###### Parameters

    - `textOrPath`: String to share, or path to file to share.

    - `image`: file path to the image or null

    - `mimeType`: type of the image or file. null if just sharing text

    - `sourceRect`: @param sourceRect The source rectangle of the button that originated the share request. This is used on some platforms to provide a hint as to where the share dialog overlay should pop up. Particularly, on the iPad with iOS 8 and higher.

  - ### share

    public void share(String textOrPath, String image, String mimeType, Rectangle sourceRect, ShareResultListener listener)

    Like `share(String,String,String,Rectangle)` but reports the outcome through `listener` on the EDT.

    `listener` may be `null`. If the underlying platform cannot report the outcome (older Android, Web Share API), the listener is still invoked with `ShareResult.sharedTo(String)` passing a `null` package name so the app can resume its flow.

    ###### Parameters

    - `textOrPath`: String to share, or path to file to share.

    - `image`: file path to the image or null

    - `mimeType`: type of the image or file. null if just sharing text

    - `sourceRect`: source rectangle hint for the share popover. May be null.

    - `listener`: callback for the share outcome. May be null.

  - ### getLocalizationManager

    public L10NManager getLocalizationManager()

    The localization manager allows adapting values for display in different locales thru parsing and formatting capabilities (similar to JavaSE's DateFormat/NumberFormat). It also includes language/locale/currency related API's similar to Locale/currency API's from JavaSE.

    The sample code below just lists the various capabilities of the API:

        Form hi = new Form("L10N", new TableLayout(16, 2));
        L10NManager l10n = L10NManager.getInstance();
        hi.add("format(double)").add(l10n.format(11.11)).
            add("format(int)").add(l10n.format(33)).
            add("formatCurrency").add(l10n.formatCurrency(53.267)).
            add("formatDateLongStyle").add(l10n.formatDateLongStyle(new Date())).
            add("formatDateShortStyle").add(l10n.formatDateShortStyle(new Date())).
            add("formatDateTime").add(l10n.formatDateTime(new Date())).
            add("formatDateTimeMedium").add(l10n.formatDateTimeMedium(new Date())).
            add("formatDateTimeShort").add(l10n.formatDateTimeShort(new Date())).
            add("getCurrencySymbol").add(l10n.getCurrencySymbol()).
            add("getLanguage").add(l10n.getLanguage()).
            add("getLocale").add(l10n.getLocale()).
            add("isRTLLocale").add("" + l10n.isRTLLocale()).
            add("parseCurrency").add(l10n.formatCurrency(l10n.parseCurrency("33.77$"))).
            add("parseDouble").add(l10n.format(l10n.parseDouble("34.35"))).
            add("parseInt").add(l10n.format(l10n.parseInt("56"))).
            add("parseLong").add("" + l10n.parseLong("4444444"));
        hi.show();

    ###### Returns

    an instance of the localization manager

  - ### registerPush

    public void registerPush(String id, boolean noFallback)

    User register to receive push notification

    ###### Parameters

    - `id`: the id for the user

    - `noFallback`: @param noFallback some devices don't support an efficient push API and will resort to polling to provide push like functionality. If this flag is set to true no polling will occur and the error PushCallback.REGISTRATION_ERROR_SERVICE_NOT_AVAILABLE will be sent to the push interface.

    ###### Deprecated

    use `#registerPush()` the Android push id should be set with the build hint `gcm.sender_id` which will work for Chrome JavaScript builds too

  - ### registerPush

    public void registerPush(Hashtable metaData, boolean noFallback)

    Register to receive push notification, invoke this method once (ever) to receive push notifications.

    ###### Parameters

    - `metaData`: @param metaData meta data for push, this is relevant on some platforms such as google where a push id is necessary,

    - `noFallback`: @param noFallback some devices don't support an efficient push API and will resort to polling to provide push like functionality. If this flag is set to true no polling will occur and the error PushCallback.REGISTRATION_ERROR_SERVICE_NOT_AVAILABLE will be sent to the push interface.

    ###### Deprecated

    use `#registerPush()` the Android push id should be set with the build hint `gcm.sender_id` which will work for Chrome JavaScript builds too

  - ### registerPush

    public void registerPush()
    Register to receive push notification, invoke this method once (ever) to receive push notifications.

  - ### deregisterPush

    public void deregisterPush()
    Stop receiving push notifications to this client application

  - ### createMediaRecorder

    public Media createMediaRecorder(String path) throws IOException

    Creates a Media recorder Object which will record from the device mic to a file in the given path. The output format will be amr-nb if supported by the platform.

    ###### Parameters

    - `path`: @param path a file path to where to store the recording, if the file does not exists it will be created.
    Throws:
      `IOException`

  - ### createMediaRecorder

    public Media createMediaRecorder(MediaRecorderBuilder builder) throws IOException

    ###### Parameters

    - `builder`: A MediaRecorderBuilder

    ###### Returns

    a MediaRecorder

    ###### Throws

    - `IOException`

    ###### Since

    7.0

    ###### Deprecated

    use MediaRecorderBuilder#build()

    ###### See also

    - MediaRecorderBuilder#build()
    Throws:
      `IOException`

  - ### createMediaRecorder

    public Media createMediaRecorder(String path, String mimeType) throws IOException

    Creates a Media recorder Object which will record from the device mic to a file in the given path.

    ###### Parameters

    - `path`: @param path a file path to where to store the recording, if the file does not exists it will be created.

    - `mimeType`: @param mimeType the output mime type that is supported see getAvailableRecordingMimeTypes()

    Throws:
      `IOException`

  - ### isSpeechRecognitionSupported

    public boolean isSpeechRecognitionSupported()
    Whether `SpeechRecognizer` is implemented on the current platform. The user may still deny mic / speech permission at call time even when this returns true.

  - ### startSpeechRecognition

    public void startSpeechRecognition(RecognitionOptions options, RecognitionCallback callback)
    Begins a speech-recognition session. See `SpeechRecognizer.recognize(RecognitionOptions, RecognitionCallback)` for the callable surface; this hook is the direct delegation point that platform ports override.

  - ### stopSpeechRecognition

    public void stopSpeechRecognition()

  - ### isTextToSpeechSupported

    public boolean isTextToSpeechSupported()
    Whether `TextToSpeech` is implemented on the current platform.

  - ### textToSpeechSpeak

    public void textToSpeechSpeak(String text, TtsOptions options)

  - ### textToSpeechStop

    public void textToSpeechStop()

  - ### textToSpeechAvailableVoices

    public String[] textToSpeechAvailableVoices()

  - ### getImageIO

    public ImageIO getImageIO()

    Returns the image IO instance that allows scaling image files.

    ###### Returns

    the image IO instance or null if image IO isn't supported for the given platform

  - ### getMediaRecorderingMimeType

    public String getMediaRecorderingMimeType()

    Gets the recording mime type for the returned Media from the createMediaRecorder method

    ###### Returns

    the recording mime type

    ###### Deprecated

    see getAvailableRecordingMimeTypes() instead

  - ### openOrCreate

    public Database openOrCreate(String databaseName) throws IOException

    Opens a database or create one if not exists. On platforms where `#isDatabaseCustomPathSupported()` this method can optionally accept a file path.

    ###### Parameters

    - `databaseName`: the name of the database

    ###### Returns

    Database Object or null if not supported on the platform

    ###### Throws

    - `IOException`: if database cannot be created
    Throws:
      `IOException`

  - ### isDatabaseCustomPathSupported

    public boolean isDatabaseCustomPathSupported()

  - ### delete

    public void delete(String databaseName) throws IOException

    Deletes database

    ###### Parameters

    - `databaseName`: the name of the database

    ###### Throws

    - `IOException`: if database cannot be deleted
    Throws:
      `IOException`

  - ### exists

    public boolean exists(String databaseName)

    Indicates weather a database exists

    ###### Parameters

    - `databaseName`: the name of the database

    ###### Returns

    true if database exists

  - ### getDatabasePath

    public String getDatabasePath(String databaseName)

    Returns the file path of the Database if support for database exists on the platform.

    ###### Parameters

    - `databaseName`: @param databaseName the name of the database with out / or path elements e.g. `mydatabase.db`

    ###### Returns

    the file path of the database or null if database isn't supported

  - ### setPollingFrequency

    public void setPollingFrequency(int freq)

    Sets the frequency for polling the server in case of polling based push notification

    ###### Parameters

    - `freq`: the frequency in milliseconds

    ###### Deprecated

    we no longer support push polling

  - ### createThread

    public Thread createThread(Runnable r, String name)

    Start a Codename One thread that supports crash protection and similar Codename One features.

    ###### Parameters

    - `r`: runnable to run, NOTICE the thread MUST be explicitly started!

    - `name`: the name for the thread

    ###### Returns

    a thread instance which must be explicitly started!

  - ### startThread

    public Thread startThread(Runnable r, String name)

    Start a Codename One thread that supports crash protection and similar Codename One features.

    ###### Parameters

    - `r`: runnable to run, NOTICE the thread MUST be explicitly started!

    - `name`: the name for the thread

    ###### Returns

    a thread instance which must be explicitly started!

    ###### Deprecated

    confusing name use `java.lang.String)` instead

  - ### isNativeTitle

    public boolean isNativeTitle()

    Indicates if the title of the Form is native title(in android ICS devices if the command behavior is native the ActionBar is used to display the title and the menu)

    ###### Returns

    true if platform would like to show the Form title

  - ### refreshNativeTitle

    public void refreshNativeTitle()
    if the title is native(e.g the android action bar), notify the native title that is needs to be refreshed

  - ### getCrashReporter

    public CrashReport getCrashReporter()

    The crash reporter gets invoked when an uncaught exception is intercepted

    ###### Returns

    the crashReporter

  - ### setCrashReporter

    public void setCrashReporter(CrashReport crashReporter)

    The crash reporter gets invoked when an uncaught exception is intercepted

    ###### Parameters

    - `crashReporter`: the crashReporter to set

  - ### getUdid

    public String getUdid()

    Returns the UDID for devices that support it

    ###### Returns

    the UDID or null

  - ### getMsisdn

    public String getMsisdn()

    Returns the MSISDN for devices that expose it

    ###### Returns

    the msisdn or null

  - ### getInAppPurchase

    public Purchase getInAppPurchase()

    Returns the native OS purchase implementation if applicable, if unavailable this method will try to fallback to a custom purchase implementation and failing that will return null

    ###### Returns

    instance of the purchase class or null

  - ### getInAppPurchase

    public Purchase getInAppPurchase(boolean d)

    ###### Deprecated

  - ### getCodeScanner

    public CodeScanner getCodeScanner()

    Returns the native implementation of the code scanner or null

    ###### Returns

    code scanner instance

    ###### Deprecated

    Use the cn1-codescanner cn1lib.

  - ### getAvailableRecordingMimeTypes

    public String[] getAvailableRecordingMimeTypes()
    Gets the available recording MimeTypes

  - ### isScreenSaverDisableSupported

    public boolean isScreenSaverDisableSupported()
    Checks if the device supports disabling the screen display from dimming, allowing the developer to keep the screen display on.

  - ### isScrollWheeling

    public boolean isScrollWheeling()

    Checks is the scroll-wheel mouse is currently scrolling. The scroll-wheel simulates pointer presses and drags so there are cases when you are processing pointer events when you may want to know if it was driggered by a scroll wheel.

    ###### Returns

    True if the scroll-wheel is responsible for current pointer events.

    ###### Since

    8.0

  - ### setScreenSaverEnabled

    public void setScreenSaverEnabled(boolean e)

    If isScreenSaverDisableSupported() returns true calling this method will lock the screen display on

    ###### Parameters

    - `e`: @param e when set to true the screen saver will work as usual and when set to false the screen will not turn off automatically

  - ### hasCamera

    public boolean hasCamera()
    Returns true if the device has camera false otherwise.

  - ### isNativePickerTypeSupported

    public boolean isNativePickerTypeSupported(int pickerType)

    Indicates whether the native picker dialog is supported for the given type which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATE

    ###### Parameters

    - `pickerType`: the picker type constant

    ###### Returns

    true if the native platform supports this picker type

  - ### showNativePicker

    public Object showNativePicker(int type, Component source, Object currentValue, Object data)

    Shows a native modal dialog allowing us to perform the picking for the given type which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATE

    ###### Parameters

    - `type`: the picker type constant

    - `source`: @param source the source component (optional) the native dialog will be placed in relation to this component if applicable

    - `currentValue`: the currently selected value

    - `data`: additional meta data specific to the picker type when applicable

    ###### Returns

    the value from the picker or null if the operation was canceled.

  - ### isMultiKeyMode

    public boolean isMultiKeyMode()

    When set to true Codename One allows multiple hardware keys to be pressed at once, this isn't on by default since it can trigger some complexities with UI navigation to/from native code

    ###### Returns

    the multiKeyMode

  - ### setMultiKeyMode

    public void setMultiKeyMode(boolean multiKeyMode)

    When set to true Codename One allows multiple hardware keys to be pressed at once, this isn't on by default since it can trigger some complexities with UI navigation to/from native code

    ###### Parameters

    - `multiKeyMode`: the multiKeyMode to set

  - ### getLongPointerPressInterval

    public int getLongPointerPressInterval()

    Long pointer press is invoked after the given interval, this allows making long press events shorter/longer

    ###### Returns

    time in milliseconds

  - ### setLongPointerPressInterval

    public void setLongPointerPressInterval(int v)

    Long pointer press is invoked after the given interval, this allows making long press events shorter/longer

    ###### Parameters

    - `v`: time in milliseconds

  - ### scheduleLocalNotification

    public void scheduleLocalNotification(LocalNotification n, long firstTime, int repeat)

    Schedules a local notification that will occur after the given time elapsed.

    The sample below combines this with the geofence API to show a local notification when entering a radius with the app in the background:

        // File: GeofenceListenerImpl.java
        public class GeofenceListenerImpl implements GeofenceListener {
        @Override
            public void onExit(String id) {
            }
        @Override
            public void onEntered(String id) {
                if(!Display.getInstance().isMinimized()) {
                    Display.getInstance().callSerially(() -> {
                        Dialog.show("Welcome", "Thanks for arriving", "OK", null);
                    });
                } else {
                    LocalNotification ln = new LocalNotification();
                    ln.setId("LnMessage");
                    ln.setAlertTitle("Welcome");
                    ln.setAlertBody("Thanks for arriving!");
                    Display.getInstance().scheduleLocalNotification(ln, System.currentTimeMillis() + 10, LocalNotification.REPEAT_NONE);
                }
            }
        }

        // File: GeofenceSample.java
        Geofence gf = new Geofence("test", loc, 100, 100000);
        LocationManager.getLocationManager().addGeoFencing(GeofenceListenerImpl.class, gf);

    ###### Parameters

    - `n`: The notification to schedule.

    - `firstTime`: time in milliseconds when to schedule the notification

    - `repeat`: @param repeat repeat one of the following: REPEAT_NONE, REPEAT_FIFTEEN_MINUTES, REPEAT_HALF_HOUR, REPEAT_HOUR, REPEAT_DAY, REPEAT_WEEK

  - ### cancelLocalNotification

    public void cancelLocalNotification(String notificationId)

    Cancels a local notification by ID.

    ###### Parameters

    - `notificationId`

    ###### See also

    - com.codename1.notifications.LocalNotification

  - ### requestNotificationPermission

    public void requestNotificationPermission(NotificationPermissionCallback callback)

    Requests permission to post notifications using a default request (alert, sound and badge). The result is delivered to the callback on the EDT. On platforms without a notification permission model the callback reports the permission as granted.

    ###### Parameters

    - `callback`: the callback to receive the result

  - ### requestNotificationPermission

    public void requestNotificationPermission(NotificationPermissionRequest request, NotificationPermissionCallback callback)

    Requests permission to post notifications with the capabilities described by the given request. The result is delivered to the callback on the EDT.

    ###### Parameters

    - `request`: describes which notification capabilities to request

    - `callback`: the callback to receive the result

  - ### registerNotificationChannel

    public void registerNotificationChannel(NotificationChannelBuilder builder)

    Registers a notification channel (Android). No-op on platforms without channels.

    ###### Parameters

    - `builder`: the channel definition

  - ### deleteNotificationChannel

    public void deleteNotificationChannel(String channelId)

    Deletes a notification channel (Android). No-op on platforms without channels.

    ###### Parameters

    - `channelId`: the channel id to delete

  - ### createNotificationChannelGroup

    public void createNotificationChannelGroup(String groupId, String groupName)

    Creates a notification channel group (Android). No-op on platforms without channels.

    ###### Parameters

    - `groupId`: the group id

    - `groupName`: the user-visible group name

  - ### scheduleBackgroundWork

    public void scheduleBackgroundWork(WorkRequest request)

    Schedules constraint-aware background work. Used internally by `com.codename1.background.BackgroundWork`.

    ###### Parameters

    - `request`: the work request

  - ### cancelBackgroundWork

    public void cancelBackgroundWork(String workId)

    Cancels scheduled background work by id.

    ###### Parameters

    - `workId`: the work id

  - ### isBackgroundWorkSupported

    public boolean isBackgroundWorkSupported()

    Returns true if constraint-aware background work is supported.

    ###### Returns

    true if supported

  - ### scheduleBackgroundProcessing

    public void scheduleBackgroundProcessing(String id, long earliestBeginEpochMs, boolean requiresNetwork, boolean requiresPower, Runnable task)

    Schedules a deferrable background processing task. Used internally by `com.codename1.background.BackgroundTask`.

    ###### Parameters

    - `id`: the task id

    - `earliestBeginEpochMs`: the earliest begin time in milliseconds since the epoch, or 0

    - `requiresNetwork`: true if network is required

    - `requiresPower`: true if charging is required

    - `task`: the work to run

  - ### cancelBackgroundProcessing

    public void cancelBackgroundProcessing(String id)

    Cancels a scheduled background processing task.

    ###### Parameters

    - `id`: the task id

  - ### isBackgroundProcessingSupported

    public boolean isBackgroundProcessingSupported()

    Returns true if deferrable background processing is supported.

    ###### Returns

    true if supported

  - ### startForegroundService

    public Object startForegroundService(String channelId, String title, String body, String iconName, ForegroundService.Task task, ForegroundService handle)

    Starts a foreground service. Used internally by `com.codename1.background.ForegroundService`.

    ###### Parameters

    - `channelId`: the notification channel id

    - `title`: the notification title

    - `body`: the notification body

    - `iconName`: the small icon resource name, or null

    - `task`: the task to run

    - `handle`: the service handle passed to the task

    ###### Returns

    an opaque native handle

  - ### updateForegroundServiceNotification

    public void updateForegroundServiceNotification(Object nativeHandle, String title, String body)

    Updates a foreground service notification.

    ###### Parameters

    - `nativeHandle`: the handle returned by `#startForegroundService`

    - `title`: the new title

    - `body`: the new body

  - ### stopForegroundService

    public void stopForegroundService(Object nativeHandle)

    Stops a foreground service.

    ###### Parameters

    - `nativeHandle`: the handle returned by `#startForegroundService`

  - ### isForegroundServiceSupported

    public boolean isForegroundServiceSupported()

    Returns true if foreground services are supported.

    ###### Returns

    true if supported

  - ### isReceiveSharedContentSupported

    public boolean isReceiveSharedContentSupported()

    Returns true if the platform can receive shared content from other apps.

    ###### Returns

    true if supported

  - ### subscribeToPushTopic

    public void subscribeToPushTopic(String topic)

    Subscribes the device to a push topic. Used internally by `com.codename1.push.Push`.

    ###### Parameters

    - `topic`: the topic name

  - ### unsubscribeFromPushTopic

    public void unsubscribeFromPushTopic(String topic)

    Unsubscribes the device from a push topic. Used internally by `com.codename1.push.Push`.

    ###### Parameters

    - `topic`: the topic name

  - ### setPreferredBackgroundFetchInterval

    public void setPreferredBackgroundFetchInterval(int seconds)

    Sets the preferred time interval between background fetches. This is only a preferred interval and is not guaranteed. Some platforms, like iOS, maintain sovereign control over when and if background fetches will be allowed. This number is used only as a guideline.

    This method must be called in order to activate background fetch.>

    Note: If the platform doesn't support background fetch (i.e. `#isBackgroundFetchSupported()` returns `false`, then this method does nothing.

    ###### Parameters

    - `seconds`: The time interval in seconds.

    ###### See also

    - #isBackgroundFetchSupported()

    - #getPreferredBackgroundFetchInterval(int) ()

    - com.codename1.background.BackgroundFetch

  - ### getPreferredBackgroundFetchInterval

    public int getPreferredBackgroundFetchInterval(int seconds)

    Gets the preferred time (in seconds) between background fetches.

    ###### Returns

    The time interval in seconds.

    ###### See also

    - #isBackgroundFetchSupported()

    - #setPreferredBackgroundFetchInterval(int)

    - com.codename1.background.BackgroundFetch

  - ### isBackgroundFetchSupported

    public boolean isBackgroundFetchSupported()

    Checks to see if the current platform supports background fetch.

    ###### Returns

    True if the current platform supports background fetch.

    ###### See also

    - #setPreferredBackgroundFetchInterval(int)

    - #getPreferredBackgroundFetchInterval(int) ()

    - com.codename1.background.BackgroundFetch

  - ### isSimulator

    public boolean isSimulator()

    Allows detecting development mode so debugging code and special cases can be used to simplify flow

    ###### Returns

    true if we are running in the simulator, false otherwise

  - ### createBackgroundMedia

    public Media createBackgroundMedia(String uri) throws IOException

    Creates an audio media that can be played in the background.

    ###### Parameters

    - `uri`: @param uri the uri of the media can start with jar://, file://, http:// (can also use rtsp:// if supported on the platform)

    ###### Returns

    Returns:

      Media a Media Object that can be used to control the playback of the media or null if background playing is not supported on the platform

      ###### Throws

      - `IOException`: if creation of media from the given URI has failed
    Throws:
      `IOException`

  - ### createBackgroundMediaAsync

    public AsyncResource<Media> createBackgroundMediaAsync(String uri)

    Creates an audio media that can be played in the background. This call is asynchronous, so that it will return perhaps before the media object is ready.

    ###### Parameters

    - `uri`: @param uri the uri of the media can start with jar://, file://, http:// (can also use rtsp:// if supported on the platform)

    ###### Returns

    Returns:
      Media a Media Object that can be used to control the playback of the media or null if background playing is not supported on the platform

  - ### gaussianBlurImage

    public Image gaussianBlurImage(Image image, float radius)

    Create a blur image from the given image. The algorithm is gaussian blur - https://en.wikipedia.org/wiki/Gaussian_blur

    ###### Parameters

    - `image`: the image to blur

    - `radius`: the radius to be used in the algorithm

  - ### isGaussianBlurSupported

    public boolean isGaussianBlurSupported()

    Returns true if gaussian blur is supported on this platform

    ###### Returns

    true if gaussian blur is supported.

  - ### refreshContacts

    public void refreshContacts()
    Refreshes the native list of contacts on devices that require this see `com.codename1.contacts.ContactsManager#refresh()`

  - ### isJailbrokenDevice

    public boolean isJailbrokenDevice()

    Returns true if this device is jailbroken or rooted, false if not or unknown. Notice that this method isn't accurate and can't detect all jailbreak/rooting cases

    ###### Returns

    true if this device is jailbroken or rooted, false if not or unknown.

  - ### getProjectBuildHints

    public Map<String,String> getProjectBuildHints()

    Returns the build hints for the simulator, this will only work in the debug environment and it's designed to allow extensions/API's to verify user settings/build hints exist

    ###### Returns

    map of the build hints that isn't modified without the codename1.arg. prefix

  - ### setProjectBuildHint

    public void setProjectBuildHint(String key, String value)

    Sets a build hint into the settings while overwriting any previous value. This will only work in the debug environment and it's designed to allow extensions/API's to verify user settings/build hints exist. Important: this will throw an exception outside of the simulator!

    ###### Parameters

    - `key`: the build hint without the codename1.arg. prefix

    - `value`: the value for the hint

  - ### canInstallOnHomescreen

    public boolean canInstallOnHomescreen()

    Checks to see if you can prompt the user to install the app on their homescreen. This is only relevant for the Javascript port with PWAs. This is not a "static" property, as it only returns true if the app is in a state that allows you to prompt the user. E.g. if you have previously prompted the user and they have declined, then this will return false.

    Best practice is to use `#onCanInstallOnHomescreen(java.lang.Runnable)` to be notified when you are allowed to prompt the user for installation. Then call `#promptInstallOnHomescreen()` inside that method - or sometime after.

    Example

        `onCanInstallOnHomescreen(()->{
             if (canInstallOnHomescreen()) {
                  if (promptInstallOnHomescreen()) {
                      // User accepted installation` else {
                      // user rejected installation
                  }
             }
        });
        }

    https://developers.google.com/web/fundamentals/app-install-banners/

    ###### Returns

    True if you are able to prompt the user to install the app on their homescreen.

    ###### See also

    - #promptInstallOnHomescreen()

    - #onCanInstallOnHomescreen(java.lang.Runnable)

  - ### promptInstallOnHomescreen

    public boolean promptInstallOnHomescreen()

    Prompts the user to install this app on their homescreen. This is only relevant in the javascript port.

    ###### Returns

    Returns:

      The result of the user prompt. true if the user accepts the installation, false if they reject it.

      ###### See also

      - #canInstallOnHomescreen()

      - #onCanInstallOnHomescreen(java.lang.Runnable)

  - ### onCanInstallOnHomescreen

    public void onCanInstallOnHomescreen(Runnable r)

    A callback fired when you are allowed to prompt the user to install the app on their homescreen. Only relevant in the javascript port.

    ###### Parameters

    - `r`: @param r Runnable that will be run when/if you are permitted to prompt the user to install the app on their homescreen.

  - ### captureScreen

    public Image captureScreen()

    Captures a screenshot of the screen.

    ###### Returns

    An image of the screen, or null if it failed.

    ###### Since

    7.0

    ###### Deprecated

    use screenshot(SuccessCallback) instead

  - ### screenshot

    public void screenshot(SuccessCallback<Image> callback)

    Captures a screenshot in the native layer which should include peer components as well.

    ###### Parameters

    - `callback`: will be invoked on the EDT with a screenshot

    ###### Since

    7.0.211

  - ### notifyPushCompletion

    public void notifyPushCompletion()

    Notifies the platform that push notification processing is complete. This is useful on iOS where the app is woken up in the background to handle a push notification and needs to signal completion to avoid being suspended prematurely.

    If the `ios.delayPushCompletion` build hint (or property) is set to "true", Codename One will NOT automatically signal completion after the `com.codename1.push.PushCallback#push(String)` method returns. Instead, the application MUST invoke this method manually when it has finished its background work (e.g. playing audio, downloading content).

  - ### setTimeout

    public Timer setTimeout(int timeout, Runnable r)

    Convenience method to schedule a task to run on the EDT after timeoutms.

    ###### Parameters

    - `timeout`: The timeout in milliseconds.

    - `r`: The task to run.

    ###### Returns

    The Timer object that can be used to cancel the task.

    ###### Since

    7.0

    ###### See also

    - #setInterval(int, java.lang.Runnable)

  - ### setInterval

    public Timer setInterval(int period, Runnable r)

    Convenience method to schedule a task to run on the EDT after periodms repeating every periodms.

    ###### Parameters

    - `period`: The delay and repeat in milliseconds.

    - `r`: The runnable to run on the EDT.

    ###### Returns

    The timer object which can be used to cancel the task.

    ###### Since

    7.0

    ###### See also

    - #setTimeout(int, java.lang.Runnable)

  - ### getSharedJavascriptContext

    public BrowserComponent getSharedJavascriptContext()

    Gets a reference to an application-wide shared Javascript context that can be used for running Javascript commands. When running in the Javascript port, this Javascript context will be the same context in which the application itself is running, so it gives you the ability to interact with the browser and DOM directly using the familiar `BrowserComponent` API.

    When running on other platforms, this shared context will be an off-screen browser component.

    Sample code allowing user to execute arbitrary Javascript code inside the shared context:

        Form hi = new Form("Hi World", new BorderLayout());
        TextArea input = new TextArea();
        TextArea output = new TextArea();
        output.setEditable(false);

        Button execute = new Button("Run");
        execute.addActionListener(evt->{
            BrowserComponent bc = CN.getSharedJavascriptContext().ready().get();
            bc.execute("callback.onSuccess(window.eval(${0}))", new Object[]{input.getText()}, res->{
                output.setText(res.toString());
            });
        });
        SplitPane split = new SplitPane(SplitPane.VERTICAL_SPLIT, input, output, "0", "50%", "99%");
        hi.add(CENTER, split);
        hi.add(NORTH, execute);

        hi.show();

    ###### Returns

    A shared BrowserComponent

    ###### Since

    7.0