-
- 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.Window.Callback,com.badlogic.gdx.Application,com.badlogic.gdx.backends.android.AndroidApplicationBase
public class AndroidApplication extends Activity implements AndroidApplicationBase
An implementation of the Application interface for Android. Create an Activity that derives from this class. In the onCreate method call the initialize method specifying the configuration for the GLSurfaceView.
-
-
Field Summary
Fields Modifier and Type Field Description protected AndroidInputinputpublic Handlerhandlerprotected final Array<Runnable>runnablesprotected final Array<Runnable>executedRunnablesprotected final SnapshotArray<LifecycleListener>lifecycleListenersprotected intlogLevelprotected ApplicationLoggerapplicationLoggerprivate KeyboardHeightProviderkeyboardHeightProvider
-
Method Summary
Modifier and Type Method Description AndroidInputgetInput()Returns the AndroidInput object associated with this AndroidApplicationBase HandlergetHandler()Returns the Handler object created by the application Array<Runnable>getRunnables()A set of usable runnables Array<Runnable>getExecutedRunnables()The currently executed runnables SnapshotArray<LifecycleListener>getLifecycleListeners()Returns the LifecycleListener array associated with this AndroidApplicationBase intgetLogLevel()voidsetLogLevel(int logLevel)ApplicationLoggergetApplicationLogger()voidsetApplicationLogger(ApplicationLogger applicationLogger)KeyboardHeightProvidergetKeyboardHeightProvider()voidinitialize(ApplicationListener listener)This method has to be called in the onCreate method. voidinitialize(ApplicationListener listener, AndroidApplicationConfiguration config)This method has to be called in the onCreate method. ViewinitializeForView(ApplicationListener listener)This method has to be called in the onCreate method. ViewinitializeForView(ApplicationListener listener, AndroidApplicationConfiguration config)This method has to be called in the onCreate method. voidonWindowFocusChanged(boolean hasFocus)voiduseImmersiveMode(boolean use)Activates Android 4.4 KitKat's 'Immersive Mode' feature. ApplicationListenergetApplicationListener()Application.ApplicationTypegetType()intgetVersion()longgetJavaHeap()longgetNativeHeap()PreferencesgetPreferences(String name)voidpostRunnable(Runnable runnable)voidonConfigurationChanged(Configuration config)voidexit()voiddebug(String tag, String message)voiddebug(String tag, String message, Throwable exception)voidlog(String tag, String message)voidlog(String tag, String message, Throwable exception)voiderror(String tag, String message)voiderror(String tag, String message, Throwable exception)voidaddLifecycleListener(LifecycleListener listener)voidremoveLifecycleListener(LifecycleListener listener)voidaddAndroidEventListener(AndroidEventListener listener)Adds an event listener for Android specific event such as onActivityResult(...). voidremoveAndroidEventListener(AndroidEventListener listener)Removes an event listener for Android specific event such as onActivityResult(...). ContextgetContext()The application or activity context WindowgetApplicationWindow()Returns the Window associated with the application AndroidAudiocreateAudio(Context context, AndroidApplicationConfiguration config)Returns the AndroidAudio to be used by the application AndroidInputcreateInput(Application activity, Context context, Object view, AndroidApplicationConfiguration config)Returns the AndroidInput to be used by the application -
Methods inherited from class android.app.Activity
addContentView, clearOverrideActivityTransition, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dismissKeyboardShortcutsHelper, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, enterPictureInPictureMode, enterPictureInPictureMode, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentFocus, getFragmentManager, 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, onAttachFragment, onAttachedToWindow, onBackPressed, onConfigurationChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onGetDirectActions, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLocalVoiceInteractionStarted, onLocalVoiceInteractionStopped, onLowMemory, onMenuItemSelected, onMenuOpened, onMultiWindowModeChanged, onNavigateUp, onNavigateUpFromChild, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPerformDirectAction, onPictureInPictureModeChanged, onPictureInPictureRequested, onPictureInPictureUiStateChanged, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onPreparePanel, onProvideAssistContent, onProvideAssistData, onProvideKeyboardShortcuts, onProvideReferrer, onRequestPermissionsResult, onRetainNonConfigurationInstance, onSearchRequested, onStateNotSaved, onTopResumedActivityChanged, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overrideActivityTransition, overridePendingTransition, postponeEnterTransition, recreate, registerActivityLifecycleCallbacks, registerComponentCallbacks, registerForContextMenu, registerScreenCaptureCallback, releaseInstance, removeDialog, reportFullyDrawn, requestDragAndDropPermissions, requestFullscreenMode, requestPermissions, requestShowKeyboardShortcuts, requestVisibleBehind, requestWindowFeature, requireViewById, runOnUiThread, setActionBar, setContentTransitionManager, setContentView, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setInheritShowWhenLocked, setIntent, setLocusContext, setMediaController, setPictureInPictureParams, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRecentsScreenshotEnabled, setRequestedOrientation, setResult, setSecondaryProgress, setShouldDockBigOverlays, setShowWhenLocked, setTaskDescription, setTheme, setTitle, setTitleColor, setTranslucent, setTurnScreenOn, setVisible, setVolumeControlStream, setVrModeEnabled, shouldDockBigOverlays, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActivities, startActivity, startActivityForResult, startActivityFromChild, startActivityFromFragment, startActivityIfNeeded, startIntentSender, startIntentSenderForResult, startIntentSenderFromChild, startLocalVoiceInteraction, startLockTask, startManagingCursor, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLocalVoiceInteraction, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterActivityLifecycleCallbacks, unregisterComponentCallbacks, unregisterForContextMenu, unregisterScreenCaptureCallback -
Methods inherited from class android.view.ContextThemeWrapper
applyOverrideConfiguration, getAssets, getResources, getTheme -
Methods inherited from class android.content.ContextWrapper
bindIsolatedService, bindService, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDatabasePath, getDeviceId, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFileStreamPath, getFilesDir, 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, peekWallpaper, registerDeviceIdChangeListener, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeSelfPermissionsOnKill, revokeUriPermission, sendBroadcast, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, startForegroundService, startInstrumentation, startService, stopService, unbindService, unregisterDeviceIdChangeListener, unregisterReceiver, updateServiceGroup -
Methods inherited from class android.content.Context
getColor, getColorStateList, getDrawable, getString, getSystemService, getText, obtainStyledAttributes, revokeSelfPermissionOnKill, sendBroadcastWithMultiplePermissions -
Methods inherited from class android.view.Window.Callback
onPointerCaptureChanged -
Methods inherited from class com.badlogic.gdx.backends.android.AndroidApplicationBase
getWindowManager, runOnUiThread, startActivity, useImmersiveMode -
Methods inherited from class com.badlogic.gdx.Application
addLifecycleListener, debug, error, exit, getApplicationListener, getApplicationLogger, getAudio, getClipboard, getFiles, getGraphics, getInput, getJavaHeap, getLogLevel, getNativeHeap, getNet, getPreferences, getType, getVersion, log, postRunnable, removeLifecycleListener, setApplicationLogger, setLogLevel -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getInput
AndroidInput getInput()
Returns the AndroidInput object associated with this AndroidApplicationBase
-
getHandler
Handler getHandler()
Returns the Handler object created by the application
-
getRunnables
Array<Runnable> getRunnables()
A set of usable runnables
-
getExecutedRunnables
Array<Runnable> getExecutedRunnables()
The currently executed runnables
-
getLifecycleListeners
SnapshotArray<LifecycleListener> getLifecycleListeners()
Returns the LifecycleListener array associated with this AndroidApplicationBase
-
getLogLevel
int getLogLevel()
-
setLogLevel
void setLogLevel(int logLevel)
-
getApplicationLogger
ApplicationLogger getApplicationLogger()
-
setApplicationLogger
void setApplicationLogger(ApplicationLogger applicationLogger)
-
getKeyboardHeightProvider
KeyboardHeightProvider getKeyboardHeightProvider()
-
initialize
void initialize(ApplicationListener listener)
This method has to be called in the onCreate method. It sets up all the things necessary to getinput, render via OpenGL and so on. Uses a default AndroidApplicationConfiguration.
- Parameters:
listener- the ApplicationListener implementing the program logic
-
initialize
void initialize(ApplicationListener listener, AndroidApplicationConfiguration config)
This method has to be called in the onCreate method. It sets up all the things necessary to getinput, render via OpenGL and so on. You can configure other aspects of the application with the rest of the fields in the AndroidApplicationConfiguration instance.
- Parameters:
listener- the ApplicationListener implementing the program logicconfig- the AndroidApplicationConfiguration, defining various settings of the application (use accelerometer,etc.).
-
initializeForView
View initializeForView(ApplicationListener listener)
This method has to be called in the onCreate method. It sets up all the things necessary to getinput, render via OpenGL and so on. Uses a default AndroidApplicationConfiguration.
Note: you have to add the returned view to your layout!
- Parameters:
listener- the ApplicationListener implementing the program logic
-
initializeForView
View initializeForView(ApplicationListener listener, AndroidApplicationConfiguration config)
This method has to be called in the onCreate method. It sets up all the things necessary to getinput, render via OpenGL and so on. You can configure other aspects of the application with the rest of the fields in the AndroidApplicationConfiguration instance.
Note: you have to add the returned view to your layout!
- Parameters:
listener- the ApplicationListener implementing the program logicconfig- the AndroidApplicationConfiguration, defining various settings of the application (use accelerometer,etc.).
-
onWindowFocusChanged
void onWindowFocusChanged(boolean hasFocus)
-
useImmersiveMode
void useImmersiveMode(boolean use)
Activates Android 4.4 KitKat's 'Immersive Mode' feature.
-
getApplicationListener
ApplicationListener getApplicationListener()
-
getType
Application.ApplicationType getType()
-
getVersion
int getVersion()
-
getJavaHeap
long getJavaHeap()
-
getNativeHeap
long getNativeHeap()
-
getPreferences
Preferences getPreferences(String name)
-
postRunnable
void postRunnable(Runnable runnable)
-
onConfigurationChanged
void onConfigurationChanged(Configuration config)
-
exit
void exit()
-
addLifecycleListener
void addLifecycleListener(LifecycleListener listener)
-
removeLifecycleListener
void removeLifecycleListener(LifecycleListener listener)
-
addAndroidEventListener
void addAndroidEventListener(AndroidEventListener listener)
Adds an event listener for Android specific event such as onActivityResult(...).
-
removeAndroidEventListener
void removeAndroidEventListener(AndroidEventListener listener)
Removes an event listener for Android specific event such as onActivityResult(...).
-
getContext
Context getContext()
The application or activity context
-
getApplicationWindow
Window getApplicationWindow()
Returns the Window associated with the application
-
createAudio
AndroidAudio createAudio(Context context, AndroidApplicationConfiguration config)
Returns the AndroidAudio to be used by the application
-
createInput
AndroidInput createInput(Application activity, Context context, Object view, AndroidApplicationConfiguration config)
Returns the AndroidInput to be used by the application
-
-
-
-