Class SDLActivity

  • All Implemented Interfaces:
    android.content.ComponentCallbacks, android.content.ComponentCallbacks2, android.view.KeyEvent.Callback, android.view.LayoutInflater.Factory, android.view.LayoutInflater.Factory2, android.view.View.OnCreateContextMenuListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.Window.Callback

    public class SDLActivity
    extends android.app.Activity
    implements android.view.View.OnSystemUiVisibilityChangeListener
    SDL Activity
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  SDLActivity.NativeState  
      protected static class  SDLActivity.SDLCommandHandler
      A Handler class for Messages from native SDL applications.
      • Nested classes/interfaces inherited from class android.app.Activity

        android.app.Activity.ScreenCaptureCallback
      • Nested classes/interfaces inherited from class android.content.Context

        android.content.Context.BindServiceFlags
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static int COMMAND_CHANGE_TITLE  
      protected static int COMMAND_CHANGE_WINDOW_STYLE  
      protected static int COMMAND_SET_KEEP_SCREEN_ON  
      protected static int COMMAND_TEXTEDIT_HIDE  
      protected static int COMMAND_USER  
      protected static boolean mActivityCreated  
      static boolean mBrokenLibraries
      If shared libraries (e.g.
      protected static org.libsdl.app.SDLClipboardHandler mClipboardHandler  
      protected static java.util.Locale mCurrentLocale  
      static SDLActivity.NativeState mCurrentNativeState  
      protected static int mCurrentRotation  
      protected static java.util.Hashtable<java.lang.Integer,​android.view.PointerIcon> mCursors  
      protected static boolean mDispatchingKeyEvent  
      protected int[] messageboxSelection
      Result of current messagebox.
      protected static boolean mFullscreenModeActive  
      static boolean mHasFocus  
      static boolean mHasMultiWindow  
      protected static HIDDeviceManager mHIDDeviceManager  
      static boolean mIsResumedCalled  
      protected static int mLastCursorID  
      protected static android.view.ViewGroup mLayout  
      protected static org.libsdl.app.SDLGenericMotionListener_API14 mMotionListener  
      static SDLActivity.NativeState mNextNativeState  
      protected static boolean mSDLMainFinished  
      protected static java.lang.Thread mSDLThread  
      protected static SDLActivity mSingleton  
      protected static SDLSurface mSurface  
      protected static SDLDummyEdit mTextEdit  
      protected static int SDL_ORIENTATION_LANDSCAPE  
      protected static int SDL_ORIENTATION_LANDSCAPE_FLIPPED  
      protected static int SDL_ORIENTATION_PORTRAIT  
      protected static int SDL_ORIENTATION_PORTRAIT_FLIPPED  
      protected static int SDL_ORIENTATION_UNKNOWN  
      • Fields inherited from class android.app.Activity

        DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, FULLSCREEN_MODE_REQUEST_ENTER, FULLSCREEN_MODE_REQUEST_EXIT, OVERRIDE_TRANSITION_CLOSE, OVERRIDE_TRANSITION_OPEN, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK
      • Fields inherited from class android.content.Context

        ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ADVANCED_PROTECTION_SERVICE, ALARM_SERVICE, APP_FUNCTION_SERVICE, APP_OPS_SERVICE, APP_SEARCH_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_ACTIVITY_STARTS, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_EXTERNAL_SERVICE_LONG, BIND_IMPORTANT, BIND_INCLUDE_CAPABILITIES, BIND_NOT_FOREGROUND, BIND_NOT_PERCEPTIBLE, BIND_PACKAGE_ISOLATED_PROCESS, BIND_SHARED_ISOLATED_PROCESS, BIND_WAIVE_PRIORITY, BIOMETRIC_SERVICE, BLOB_STORE_SERVICE, BLUETOOTH_SERVICE, BUGREPORT_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, COMPANION_DEVICE_SERVICE, CONNECTIVITY_DIAGNOSTICS_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTACT_KEYS_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, CREDENTIAL_SERVICE, CROSS_PROFILE_APPS_SERVICE, DEVICE_ID_DEFAULT, DEVICE_ID_INVALID, DEVICE_LOCK_SERVICE, DEVICE_POLICY_SERVICE, DISPLAY_HASH_SERVICE, DISPLAY_SERVICE, DOMAIN_VERIFICATION_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, EUICC_SERVICE, FILE_INTEGRITY_SERVICE, FINGERPRINT_SERVICE, GAME_SERVICE, GRAMMATICAL_INFLECTION_SERVICE, HARDWARE_PROPERTIES_SERVICE, HEALTHCONNECT_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, IPSEC_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, KEYSTORE_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCALE_SERVICE, LOCATION_SERVICE, MEDIA_COMMUNICATION_SERVICE, MEDIA_METRICS_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_QUALITY_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, OVERLAY_SERVICE, PEOPLE_SERVICE, PERFORMANCE_HINT_SERVICE, PERSISTENT_DATA_BLOCK_SERVICE, POWER_SERVICE, PRINT_SERVICE, PROFILING_SERVICE, RECEIVER_EXPORTED, RECEIVER_NOT_EXPORTED, RECEIVER_VISIBLE_TO_INSTANT_APPS, RESTRICTIONS_SERVICE, ROLE_SERVICE, SATELLITE_SERVICE, SEARCH_SERVICE, SECURITY_STATE_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STATUS_BAR_SERVICE, STORAGE_SERVICE, STORAGE_STATS_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_IMS_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TETHERING_SERVICE, TEXT_CLASSIFICATION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_AD_SERVICE, TV_INPUT_SERVICE, TV_INTERACTIVE_APP_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_MANAGER_SERVICE, VIBRATOR_SERVICE, VIRTUAL_DEVICE_SERVICE, VPN_MANAGEMENT_SERVICE, WALLPAPER_SERVICE, WIFI_AWARE_SERVICE, WIFI_P2P_SERVICE, WIFI_RTT_RANGING_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
      • Fields inherited from interface android.content.ComponentCallbacks2

        TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
    • Constructor Summary

      Constructors 
      Constructor Description
      SDLActivity()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String clipboardGetText()
      This method is called by SDL using JNI.
      static boolean clipboardHasText()
      This method is called by SDL using JNI.
      static void clipboardSetText​(java.lang.String string)
      This method is called by SDL using JNI.
      static int createCustomCursor​(int[] colors, int width, int height, int hotSpotX, int hotSpotY)
      This method is called by SDL using JNI.
      protected SDLSurface createSDLSurface​(android.content.Context context)  
      static void destroyCustomCursor​(int cursorID)
      This method is called by SDL using JNI.
      static boolean dispatchingKeyEvent()  
      boolean dispatchKeyEvent​(android.view.KeyEvent event)  
      static java.lang.String formatLocale​(java.util.Locale locale)  
      protected java.lang.String[] getArguments()
      This method is called by SDL before starting the native application thread.
      static android.view.View getContentView()  
      static android.app.Activity getContext()
      This method is called by SDL using JNI.
      static int getCurrentRotation()  
      static double getDiagonal()  
      protected java.lang.String[] getLibraries()
      This method is called by SDL before loading the native shared libraries.
      protected java.lang.String getMainFunction()
      This method returns the name of the application entry point It can be overridden by derived classes.
      protected java.lang.String getMainSharedObject()
      This method returns the name of the shared object with the application entry point It can be overridden by derived classes.
      static boolean getManifestEnvironmentVariables()
      This method is called by SDL using JNI.
      static org.libsdl.app.SDLGenericMotionListener_API14 getMotionListener()  
      static android.view.Surface getNativeSurface()
      This method is called by SDL using JNI.
      static int getNaturalOrientation()  
      static java.lang.String getPreferredLocales()
      This method is called by SDL using JNI.
      static boolean handleKeyEvent​(android.view.View v, int keyCode, android.view.KeyEvent event, android.view.inputmethod.InputConnection ic)  
      static void handleNativeState()  
      static void initialize()  
      static void initTouch()
      This method is called by SDL using JNI.
      static boolean isAndroidTV()
      This method is called by SDL using JNI.
      static boolean isChromebook()
      This method is called by SDL using JNI.
      static boolean isDeXMode()
      This method is called by SDL using JNI.
      static boolean isTablet()
      This method is called by SDL using JNI.
      static boolean isTextInputEvent​(android.view.KeyEvent event)  
      static boolean isVRHeadset()  
      void loadLibraries()  
      protected void main()
      The application entry point, called on a dedicated thread (SDLThread).
      static void manualBackButton()  
      protected void messageboxCreateAndShow​(android.os.Bundle args)  
      int messageboxShowMessageBox​(int flags, java.lang.String title, java.lang.String message, int[] buttonFlags, int[] buttonIds, java.lang.String[] buttonTexts, int[] colors)
      This method is called by SDL using JNI.
      static void minimizeWindow()
      This method is called by SDL using JNI.
      static void nativeAddTouch​(int touchId, java.lang.String name)  
      static boolean nativeAllowRecreateActivity()  
      static int nativeCheckSDLThreadCounter()  
      static void nativeCleanupMainThread()  
      static void nativeFocusChanged​(boolean hasFocus)  
      static java.lang.String nativeGetHint​(java.lang.String name)  
      static boolean nativeGetHintBoolean​(java.lang.String name, boolean default_value)  
      static java.lang.String nativeGetVersion()  
      static void nativeInitMainThread()  
      static void nativeLowMemory()  
      static void nativePause()  
      static void nativePermissionResult​(int requestCode, boolean result)  
      static void nativeQuit()  
      static void nativeResume()  
      static int nativeRunMain​(java.lang.String library, java.lang.String function, java.lang.Object arguments)  
      static void nativeSendQuit()  
      static void nativeSetenv​(java.lang.String name, java.lang.String value)  
      static void nativeSetNaturalOrientation​(int orientation)  
      static void nativeSetScreenResolution​(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, float density, float rate)  
      static void nativeSetupJNI()  
      protected void onActivityResult​(int requestCode, int resultCode, android.content.Intent data)  
      void onBackPressed()  
      void onConfigurationChanged​(android.content.res.Configuration newConfig)  
      protected void onCreate​(android.os.Bundle savedInstanceState)  
      protected void onDestroy()  
      static void onNativeAccel​(float x, float y, float z)  
      static void onNativeClipboardChanged()  
      static void onNativeDarkModeChanged​(boolean enabled)  
      static void onNativeDropFile​(java.lang.String filename)  
      static void onNativeFileDialog​(int requestCode, java.lang.String[] filelist, int filter)  
      static void onNativeInsetsChanged​(int left, int right, int top, int bottom)  
      static void onNativeKeyboardFocusLost()  
      static void onNativeKeyDown​(int keycode)  
      static void onNativeKeyUp​(int keycode)  
      static void onNativeLocaleChanged()  
      static void onNativeMouse​(int button, int action, float x, float y, boolean relative)  
      static void onNativePen​(int penId, int device_type, int button, int action, float x, float y, float p)  
      static void onNativePinchEnd()  
      static void onNativePinchStart()  
      static void onNativePinchUpdate​(float scale)  
      static void onNativeResize()  
      static void onNativeRotationChanged​(int rotation)  
      static void onNativeScreenKeyboardHidden()  
      static void onNativeScreenKeyboardShown()  
      static boolean onNativeSoftReturnKey()  
      static void onNativeSurfaceChanged()  
      static void onNativeSurfaceCreated()  
      static void onNativeSurfaceDestroyed()  
      static void onNativeTouch​(int touchDevId, int pointerFingerId, int action, float x, float y, float p)  
      protected void onPause()  
      void onRequestPermissionsResult​(int requestCode, java.lang.String[] permissions, int[] grantResults)  
      protected void onResume()  
      protected void onStart()  
      protected void onStop()  
      void onSystemUiVisibilityChange​(int visibility)  
      void onTrimMemory​(int level)  
      protected boolean onUnhandledMessage​(int command, java.lang.Object param)
      This method is called by SDL if SDL did not handle a message itself.
      void onWindowFocusChanged​(boolean hasFocus)  
      static int openFileDescriptor​(java.lang.String uri, java.lang.String mode)
      This method is called by SDL using JNI.
      static boolean openURL​(java.lang.String url)
      This method is called by SDL using JNI.
      protected void pauseNativeThread()  
      void pressBackButton()  
      static void requestPermission​(java.lang.String permission, int requestCode)
      This method is called by SDL using JNI.
      protected void resumeNativeThread()  
      protected boolean sendCommand​(int command, java.lang.Object data)  
      static boolean sendMessage​(int command, int param)
      This method is called by SDL using JNI.
      static boolean setActivityTitle​(java.lang.String title)
      This method is called by SDL using JNI.
      static boolean setCustomCursor​(int cursorID)
      This method is called by SDL using JNI.
      static void setOrientation​(int w, int h, boolean resizable, java.lang.String hint)
      This method is called by SDL using JNI.
      void setOrientationBis​(int w, int h, boolean resizable, java.lang.String hint)
      This can be overridden
      static boolean setRelativeMouseEnabled​(boolean enabled)
      This method is called by SDL using JNI.
      static boolean setSystemCursor​(int cursorID)
      This method is called by SDL using JNI.
      static void setWindowStyle​(boolean fullscreen)
      This method is called by SDL using JNI.
      static boolean shouldMinimizeOnFocusLoss()
      This method is called by SDL using JNI.
      static boolean showFileDialog​(java.lang.String[] filters, boolean allowMultiple, boolean forWrite, int requestCode)
      This method is called by SDL using JNI.
      static boolean showTextInput​(int input_type, int x, int y, int w, int h)
      This method is called by SDL using JNI.
      static boolean showToast​(java.lang.String message, int duration, int gravity, int xOffset, int yOffset)
      This method is called by SDL using JNI.
      void superOnBackPressed()  
      static boolean supportsRelativeMouse()
      This method is called by SDL using JNI.
      • Methods inherited from class android.app.Activity

        addContentView, attachBaseContext, clearOverrideActivityTransition, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dismissKeyboardShortcutsHelper, dispatchGenericMotionEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, enterPictureInPictureMode, enterPictureInPictureMode, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCaller, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentCaller, getCurrentFocus, getFragmentManager, getInitialCaller, getIntent, getLastNonConfigurationInstance, getLaunchedFromPackage, getLaunchedFromUid, getLayoutInflater, getLoaderManager, getLocalClassName, getMaxNumPictureInPictureActions, getMediaController, getMenuInflater, getOnBackInvokedDispatcher, getParent, getParentActivityIntent, getPreferences, getReferrer, getRequestedOrientation, getSearchEvent, getSplashScreen, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isActivityTransitionRunning, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isInMultiWindowMode, isInPictureInPictureMode, isLaunchedFromBubble, isLocalVoiceInteractionSupported, isTaskRoot, isVoiceInteraction, isVoiceInteractionRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onActivityResult, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onChildTitleChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onGetDirectActions, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLocalVoiceInteractionStarted, onLocalVoiceInteractionStopped, onLowMemory, onMenuItemSelected, onMenuOpened, onMultiWindowModeChanged, onMultiWindowModeChanged, onNavigateUp, onNavigateUpFromChild, onNewIntent, onNewIntent, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPerformDirectAction, onPictureInPictureModeChanged, onPictureInPictureModeChanged, onPictureInPictureRequested, onPictureInPictureUiStateChanged, onPostCreate, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onPreparePanel, onProvideAssistContent, onProvideAssistData, onProvideKeyboardShortcuts, onProvideReferrer, onRequestPermissionsResult, onRestart, onRestoreInstanceState, onRestoreInstanceState, onRetainNonConfigurationInstance, onSaveInstanceState, onSaveInstanceState, onSearchRequested, onSearchRequested, onStateNotSaved, onTitleChanged, onTopResumedActivityChanged, onTouchEvent, onTrackballEvent, onUserInteraction, onUserLeaveHint, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowStartingActionMode, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overrideActivityTransition, overrideActivityTransition, overridePendingTransition, overridePendingTransition, postponeEnterTransition, recreate, registerActivityLifecycleCallbacks, registerComponentCallbacks, registerForContextMenu, registerScreenCaptureCallback, releaseInstance, removeDialog, reportFullyDrawn, requestDragAndDropPermissions, requestFullscreenMode, requestOpenInBrowserEducation, requestPermissions, requestPermissions, requestShowKeyboardShortcuts, requestVisibleBehind, requestWindowFeature, requireViewById, runOnUiThread, setActionBar, setAllowCrossUidActivitySwitchFromBelow, setContentTransitionManager, setContentView, setContentView, setContentView, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setInheritShowWhenLocked, setIntent, setIntent, setLocusContext, setMediaController, setPictureInPictureParams, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRecentsScreenshotEnabled, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setShouldDockBigOverlays, setShowWhenLocked, setTaskDescription, setTheme, setTitle, setTitle, setTitleColor, setTranslucent, setTurnScreenOn, setVisible, setVolumeControlStream, setVrModeEnabled, shouldDockBigOverlays, shouldShowRequestPermissionRationale, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityForResult, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startLocalVoiceInteraction, startLockTask, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLocalVoiceInteraction, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterActivityLifecycleCallbacks, unregisterComponentCallbacks, unregisterForContextMenu, unregisterScreenCaptureCallback
      • Methods inherited from class android.view.ContextThemeWrapper

        applyOverrideConfiguration, getAssets, getResources, getTheme, setTheme
      • Methods inherited from class android.content.ContextWrapper

        bindIsolatedService, bindService, bindService, bindService, bindService, bindServiceAsUser, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkContentUriPermissionFull, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDeviceId, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getParams, getSharedPreferences, getSystemServiceName, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, isUiContext, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerDeviceIdChangeListener, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeSelfPermissionsOnKill, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startForegroundService, startInstrumentation, startService, stopService, unbindService, unregisterDeviceIdChangeListener, unregisterReceiver, updateServiceGroup
      • Methods inherited from class android.content.Context

        bindIsolatedService, getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, revokeSelfPermissionOnKill, sendBroadcastWithMultiplePermissions
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface android.view.Window.Callback

        onPointerCaptureChanged
    • Field Detail

      • mIsResumedCalled

        public static boolean mIsResumedCalled
      • mHasFocus

        public static boolean mHasFocus
      • mHasMultiWindow

        public static final boolean mHasMultiWindow
      • SDL_ORIENTATION_UNKNOWN

        protected static final int SDL_ORIENTATION_UNKNOWN
        See Also:
        Constant Field Values
      • SDL_ORIENTATION_LANDSCAPE

        protected static final int SDL_ORIENTATION_LANDSCAPE
        See Also:
        Constant Field Values
      • SDL_ORIENTATION_LANDSCAPE_FLIPPED

        protected static final int SDL_ORIENTATION_LANDSCAPE_FLIPPED
        See Also:
        Constant Field Values
      • SDL_ORIENTATION_PORTRAIT

        protected static final int SDL_ORIENTATION_PORTRAIT
        See Also:
        Constant Field Values
      • SDL_ORIENTATION_PORTRAIT_FLIPPED

        protected static final int SDL_ORIENTATION_PORTRAIT_FLIPPED
        See Also:
        Constant Field Values
      • mCurrentRotation

        protected static int mCurrentRotation
      • mCurrentLocale

        protected static java.util.Locale mCurrentLocale
      • mBrokenLibraries

        public static boolean mBrokenLibraries
        If shared libraries (e.g. SDL or the native application) could not be loaded.
      • mLayout

        protected static android.view.ViewGroup mLayout
      • mClipboardHandler

        protected static org.libsdl.app.SDLClipboardHandler mClipboardHandler
      • mCursors

        protected static java.util.Hashtable<java.lang.Integer,​android.view.PointerIcon> mCursors
      • mLastCursorID

        protected static int mLastCursorID
      • mMotionListener

        protected static org.libsdl.app.SDLGenericMotionListener_API14 mMotionListener
      • mSDLThread

        protected static java.lang.Thread mSDLThread
      • mSDLMainFinished

        protected static boolean mSDLMainFinished
      • mActivityCreated

        protected static boolean mActivityCreated
      • mDispatchingKeyEvent

        protected static boolean mDispatchingKeyEvent
      • COMMAND_CHANGE_WINDOW_STYLE

        protected static final int COMMAND_CHANGE_WINDOW_STYLE
        See Also:
        Constant Field Values
      • COMMAND_TEXTEDIT_HIDE

        protected static final int COMMAND_TEXTEDIT_HIDE
        See Also:
        Constant Field Values
      • COMMAND_SET_KEEP_SCREEN_ON

        protected static final int COMMAND_SET_KEEP_SCREEN_ON
        See Also:
        Constant Field Values
      • mFullscreenModeActive

        protected static boolean mFullscreenModeActive
      • messageboxSelection

        protected final int[] messageboxSelection
        Result of current messagebox. Also used for blocking the calling thread.
    • Constructor Detail

      • SDLActivity

        public SDLActivity()
    • Method Detail

      • getMotionListener

        public static org.libsdl.app.SDLGenericMotionListener_API14 getMotionListener()
      • main

        protected void main()
        The application entry point, called on a dedicated thread (SDLThread). The default implementation uses the getMainSharedObject() and getMainFunction() methods to invoke native code from the specified shared library. It can be overridden by derived classes.
      • getMainSharedObject

        protected java.lang.String getMainSharedObject()
        This method returns the name of the shared object with the application entry point It can be overridden by derived classes.
      • getMainFunction

        protected java.lang.String getMainFunction()
        This method returns the name of the application entry point It can be overridden by derived classes.
      • getLibraries

        protected java.lang.String[] getLibraries()
        This method is called by SDL before loading the native shared libraries. It can be overridden to provide names of shared libraries to be loaded. The default implementation returns the defaults. It never returns null. An array returned by a new implementation must at least contain "SDL3". Also keep in mind that the order the libraries are loaded may matter.
        Returns:
        names of shared libraries to be loaded (e.g. "SDL3", "main").
      • loadLibraries

        public void loadLibraries()
      • getArguments

        protected java.lang.String[] getArguments()
        This method is called by SDL before starting the native application thread. It can be overridden to provide the arguments after the application name. The default implementation returns an empty array. It never returns null.
        Returns:
        arguments for the native application.
      • initialize

        public static void initialize()
      • createSDLSurface

        protected SDLSurface createSDLSurface​(android.content.Context context)
      • onCreate

        protected void onCreate​(android.os.Bundle savedInstanceState)
        Overrides:
        onCreate in class android.app.Activity
      • pauseNativeThread

        protected void pauseNativeThread()
      • resumeNativeThread

        protected void resumeNativeThread()
      • onPause

        protected void onPause()
        Overrides:
        onPause in class android.app.Activity
      • onResume

        protected void onResume()
        Overrides:
        onResume in class android.app.Activity
      • onStop

        protected void onStop()
        Overrides:
        onStop in class android.app.Activity
      • onStart

        protected void onStart()
        Overrides:
        onStart in class android.app.Activity
      • getNaturalOrientation

        public static int getNaturalOrientation()
      • getCurrentRotation

        public static int getCurrentRotation()
      • onWindowFocusChanged

        public void onWindowFocusChanged​(boolean hasFocus)
        Specified by:
        onWindowFocusChanged in interface android.view.Window.Callback
        Overrides:
        onWindowFocusChanged in class android.app.Activity
      • onTrimMemory

        public void onTrimMemory​(int level)
        Specified by:
        onTrimMemory in interface android.content.ComponentCallbacks2
        Overrides:
        onTrimMemory in class android.app.Activity
      • onConfigurationChanged

        public void onConfigurationChanged​(android.content.res.Configuration newConfig)
        Specified by:
        onConfigurationChanged in interface android.content.ComponentCallbacks
        Overrides:
        onConfigurationChanged in class android.app.Activity
      • onDestroy

        protected void onDestroy()
        Overrides:
        onDestroy in class android.app.Activity
      • onBackPressed

        public void onBackPressed()
        Overrides:
        onBackPressed in class android.app.Activity
      • onActivityResult

        protected void onActivityResult​(int requestCode,
                                        int resultCode,
                                        android.content.Intent data)
        Overrides:
        onActivityResult in class android.app.Activity
      • manualBackButton

        public static void manualBackButton()
      • pressBackButton

        public void pressBackButton()
      • superOnBackPressed

        public void superOnBackPressed()
      • dispatchKeyEvent

        public boolean dispatchKeyEvent​(android.view.KeyEvent event)
        Specified by:
        dispatchKeyEvent in interface android.view.Window.Callback
        Overrides:
        dispatchKeyEvent in class android.app.Activity
      • dispatchingKeyEvent

        public static boolean dispatchingKeyEvent()
      • handleNativeState

        public static void handleNativeState()
      • onUnhandledMessage

        protected boolean onUnhandledMessage​(int command,
                                             java.lang.Object param)
        This method is called by SDL if SDL did not handle a message itself. This happens if a received message contains an unsupported command. Method can be overwritten to handle Messages in a different class.
        Parameters:
        command - the command of the message.
        param - the parameter of the message. May be null.
        Returns:
        if the message was handled in overridden method.
      • sendCommand

        protected boolean sendCommand​(int command,
                                      java.lang.Object data)
      • nativeGetVersion

        public static java.lang.String nativeGetVersion()
      • nativeSetupJNI

        public static void nativeSetupJNI()
      • nativeInitMainThread

        public static void nativeInitMainThread()
      • nativeCleanupMainThread

        public static void nativeCleanupMainThread()
      • nativeRunMain

        public static int nativeRunMain​(java.lang.String library,
                                        java.lang.String function,
                                        java.lang.Object arguments)
      • nativeLowMemory

        public static void nativeLowMemory()
      • nativeSendQuit

        public static void nativeSendQuit()
      • nativeQuit

        public static void nativeQuit()
      • nativePause

        public static void nativePause()
      • nativeResume

        public static void nativeResume()
      • nativeFocusChanged

        public static void nativeFocusChanged​(boolean hasFocus)
      • onNativeDropFile

        public static void onNativeDropFile​(java.lang.String filename)
      • nativeSetScreenResolution

        public static void nativeSetScreenResolution​(int surfaceWidth,
                                                     int surfaceHeight,
                                                     int deviceWidth,
                                                     int deviceHeight,
                                                     float density,
                                                     float rate)
      • onNativeResize

        public static void onNativeResize()
      • onNativeKeyDown

        public static void onNativeKeyDown​(int keycode)
      • onNativeKeyUp

        public static void onNativeKeyUp​(int keycode)
      • onNativeSoftReturnKey

        public static boolean onNativeSoftReturnKey()
      • onNativeKeyboardFocusLost

        public static void onNativeKeyboardFocusLost()
      • onNativeMouse

        public static void onNativeMouse​(int button,
                                         int action,
                                         float x,
                                         float y,
                                         boolean relative)
      • onNativeTouch

        public static void onNativeTouch​(int touchDevId,
                                         int pointerFingerId,
                                         int action,
                                         float x,
                                         float y,
                                         float p)
      • onNativePen

        public static void onNativePen​(int penId,
                                       int device_type,
                                       int button,
                                       int action,
                                       float x,
                                       float y,
                                       float p)
      • onNativeAccel

        public static void onNativeAccel​(float x,
                                         float y,
                                         float z)
      • onNativeClipboardChanged

        public static void onNativeClipboardChanged()
      • onNativeSurfaceCreated

        public static void onNativeSurfaceCreated()
      • onNativeSurfaceChanged

        public static void onNativeSurfaceChanged()
      • onNativeSurfaceDestroyed

        public static void onNativeSurfaceDestroyed()
      • onNativeScreenKeyboardShown

        public static void onNativeScreenKeyboardShown()
      • onNativeScreenKeyboardHidden

        public static void onNativeScreenKeyboardHidden()
      • nativeGetHint

        public static java.lang.String nativeGetHint​(java.lang.String name)
      • nativeGetHintBoolean

        public static boolean nativeGetHintBoolean​(java.lang.String name,
                                                   boolean default_value)
      • nativeSetenv

        public static void nativeSetenv​(java.lang.String name,
                                        java.lang.String value)
      • nativeSetNaturalOrientation

        public static void nativeSetNaturalOrientation​(int orientation)
      • onNativeRotationChanged

        public static void onNativeRotationChanged​(int rotation)
      • onNativeInsetsChanged

        public static void onNativeInsetsChanged​(int left,
                                                 int right,
                                                 int top,
                                                 int bottom)
      • nativeAddTouch

        public static void nativeAddTouch​(int touchId,
                                          java.lang.String name)
      • nativePermissionResult

        public static void nativePermissionResult​(int requestCode,
                                                  boolean result)
      • onNativeLocaleChanged

        public static void onNativeLocaleChanged()
      • onNativeDarkModeChanged

        public static void onNativeDarkModeChanged​(boolean enabled)
      • nativeAllowRecreateActivity

        public static boolean nativeAllowRecreateActivity()
      • nativeCheckSDLThreadCounter

        public static int nativeCheckSDLThreadCounter()
      • onNativeFileDialog

        public static void onNativeFileDialog​(int requestCode,
                                              java.lang.String[] filelist,
                                              int filter)
      • onNativePinchStart

        public static void onNativePinchStart()
      • onNativePinchUpdate

        public static void onNativePinchUpdate​(float scale)
      • onNativePinchEnd

        public static void onNativePinchEnd()
      • setActivityTitle

        public static boolean setActivityTitle​(java.lang.String title)
        This method is called by SDL using JNI.
      • setWindowStyle

        public static void setWindowStyle​(boolean fullscreen)
        This method is called by SDL using JNI.
      • setOrientation

        public static void setOrientation​(int w,
                                          int h,
                                          boolean resizable,
                                          java.lang.String hint)
        This method is called by SDL using JNI. This is a static method for JNI convenience, it calls a non-static method so that is can be overridden
      • setOrientationBis

        public void setOrientationBis​(int w,
                                      int h,
                                      boolean resizable,
                                      java.lang.String hint)
        This can be overridden
      • minimizeWindow

        public static void minimizeWindow()
        This method is called by SDL using JNI.
      • shouldMinimizeOnFocusLoss

        public static boolean shouldMinimizeOnFocusLoss()
        This method is called by SDL using JNI.
      • supportsRelativeMouse

        public static boolean supportsRelativeMouse()
        This method is called by SDL using JNI.
      • setRelativeMouseEnabled

        public static boolean setRelativeMouseEnabled​(boolean enabled)
        This method is called by SDL using JNI.
      • sendMessage

        public static boolean sendMessage​(int command,
                                          int param)
        This method is called by SDL using JNI.
      • getContext

        public static android.app.Activity getContext()
        This method is called by SDL using JNI.
      • isAndroidTV

        public static boolean isAndroidTV()
        This method is called by SDL using JNI.
      • isVRHeadset

        public static boolean isVRHeadset()
      • getDiagonal

        public static double getDiagonal()
      • isTablet

        public static boolean isTablet()
        This method is called by SDL using JNI.
      • isChromebook

        public static boolean isChromebook()
        This method is called by SDL using JNI.
      • isDeXMode

        public static boolean isDeXMode()
        This method is called by SDL using JNI.
      • getManifestEnvironmentVariables

        public static boolean getManifestEnvironmentVariables()
        This method is called by SDL using JNI.
      • getContentView

        public static android.view.View getContentView()
      • showTextInput

        public static boolean showTextInput​(int input_type,
                                            int x,
                                            int y,
                                            int w,
                                            int h)
        This method is called by SDL using JNI.
      • isTextInputEvent

        public static boolean isTextInputEvent​(android.view.KeyEvent event)
      • handleKeyEvent

        public static boolean handleKeyEvent​(android.view.View v,
                                             int keyCode,
                                             android.view.KeyEvent event,
                                             android.view.inputmethod.InputConnection ic)
      • getNativeSurface

        public static android.view.Surface getNativeSurface()
        This method is called by SDL using JNI.
      • initTouch

        public static void initTouch()
        This method is called by SDL using JNI.
      • messageboxShowMessageBox

        public int messageboxShowMessageBox​(int flags,
                                            java.lang.String title,
                                            java.lang.String message,
                                            int[] buttonFlags,
                                            int[] buttonIds,
                                            java.lang.String[] buttonTexts,
                                            int[] colors)
        This method is called by SDL using JNI. Shows the messagebox from UI thread and block calling thread. buttonFlags, buttonIds and buttonTexts must have same length.
        Parameters:
        buttonFlags - array containing flags for every button.
        buttonIds - array containing id for every button.
        buttonTexts - array containing text for every button.
        colors - null for default or array of length 5 containing colors.
        Returns:
        button id or -1.
      • messageboxCreateAndShow

        protected void messageboxCreateAndShow​(android.os.Bundle args)
      • onSystemUiVisibilityChange

        public void onSystemUiVisibilityChange​(int visibility)
        Specified by:
        onSystemUiVisibilityChange in interface android.view.View.OnSystemUiVisibilityChangeListener
      • clipboardHasText

        public static boolean clipboardHasText()
        This method is called by SDL using JNI.
      • clipboardGetText

        public static java.lang.String clipboardGetText()
        This method is called by SDL using JNI.
      • clipboardSetText

        public static void clipboardSetText​(java.lang.String string)
        This method is called by SDL using JNI.
      • createCustomCursor

        public static int createCustomCursor​(int[] colors,
                                             int width,
                                             int height,
                                             int hotSpotX,
                                             int hotSpotY)
        This method is called by SDL using JNI.
      • destroyCustomCursor

        public static void destroyCustomCursor​(int cursorID)
        This method is called by SDL using JNI.
      • setCustomCursor

        public static boolean setCustomCursor​(int cursorID)
        This method is called by SDL using JNI.
      • setSystemCursor

        public static boolean setSystemCursor​(int cursorID)
        This method is called by SDL using JNI.
      • requestPermission

        public static void requestPermission​(java.lang.String permission,
                                             int requestCode)
        This method is called by SDL using JNI.
      • onRequestPermissionsResult

        public void onRequestPermissionsResult​(int requestCode,
                                               java.lang.String[] permissions,
                                               int[] grantResults)
        Overrides:
        onRequestPermissionsResult in class android.app.Activity
      • openURL

        public static boolean openURL​(java.lang.String url)
        This method is called by SDL using JNI.
      • showToast

        public static boolean showToast​(java.lang.String message,
                                        int duration,
                                        int gravity,
                                        int xOffset,
                                        int yOffset)
        This method is called by SDL using JNI.
      • openFileDescriptor

        public static int openFileDescriptor​(java.lang.String uri,
                                             java.lang.String mode)
                                      throws java.lang.Exception
        This method is called by SDL using JNI.
        Throws:
        java.lang.Exception
      • showFileDialog

        public static boolean showFileDialog​(java.lang.String[] filters,
                                             boolean allowMultiple,
                                             boolean forWrite,
                                             int requestCode)
        This method is called by SDL using JNI.
      • getPreferredLocales

        public static java.lang.String getPreferredLocales()
        This method is called by SDL using JNI.
      • formatLocale

        public static java.lang.String formatLocale​(java.util.Locale locale)