public class AndroidApplication
extends Activity
Application
interface for Android. Create an Activity
that derives from this class. In
the Activity#onCreate(Bundle)
method call the initialize(ApplicationListener)
method specifying the
configuration for the GLSurfaceView.Modifier and Type | Field and Description |
---|---|
protected ApplicationLogger |
applicationLogger |
protected AndroidAudio |
audio |
protected AndroidClipboard |
clipboard |
protected Array<java.lang.Runnable> |
executedRunnables |
protected AndroidFiles |
files |
protected boolean |
firstResume |
protected AndroidGraphics |
graphics |
Handler |
handler |
protected boolean |
hideStatusBar |
protected AndroidInput |
input |
protected SnapshotArray<LifecycleListener> |
lifecycleListeners |
protected ApplicationListener |
listener |
protected int |
logLevel |
protected AndroidNet |
net |
protected Array<java.lang.Runnable> |
runnables |
protected boolean |
useImmersiveMode |
Constructor and Description |
---|
AndroidApplication() |
Modifier and Type | Method and Description |
---|---|
void |
addAndroidEventListener(AndroidEventListener listener)
Adds an event listener for Android specific event such as onActivityResult(...).
|
void |
addLifecycleListener(LifecycleListener listener) |
AndroidAudio |
createAudio(Context context,
AndroidApplicationConfiguration config) |
AndroidInput |
createInput(Application activity,
Context context,
java.lang.Object view,
AndroidApplicationConfiguration config) |
protected FrameLayout.LayoutParams |
createLayoutParams() |
protected void |
createWakeLock(boolean use) |
void |
debug(java.lang.String tag,
java.lang.String message) |
void |
debug(java.lang.String tag,
java.lang.String message,
java.lang.Throwable exception) |
void |
error(java.lang.String tag,
java.lang.String message) |
void |
error(java.lang.String tag,
java.lang.String message,
java.lang.Throwable exception) |
void |
exit() |
ApplicationListener |
getApplicationListener() |
ApplicationLogger |
getApplicationLogger() |
Window |
getApplicationWindow() |
Audio |
getAudio() |
Clipboard |
getClipboard() |
Context |
getContext() |
Array<java.lang.Runnable> |
getExecutedRunnables() |
Files |
getFiles() |
Graphics |
getGraphics() |
Handler |
getHandler() |
AndroidInput |
getInput() |
long |
getJavaHeap() |
SnapshotArray<LifecycleListener> |
getLifecycleListeners() |
int |
getLogLevel() |
long |
getNativeHeap() |
Net |
getNet() |
Preferences |
getPreferences(java.lang.String name) |
Array<java.lang.Runnable> |
getRunnables() |
ApplicationType |
getType() |
int |
getVersion() |
protected void |
hideStatusBar(boolean hide) |
void |
initialize(ApplicationListener listener)
This method has to be called in the
Activity#onCreate(Bundle) method. |
void |
initialize(ApplicationListener listener,
AndroidApplicationConfiguration config)
This method has to be called in the
Activity#onCreate(Bundle) method. |
View |
initializeForView(ApplicationListener listener)
This method has to be called in the
Activity#onCreate(Bundle) method. |
View |
initializeForView(ApplicationListener listener,
AndroidApplicationConfiguration config)
This method has to be called in the
Activity#onCreate(Bundle) method. |
void |
log(java.lang.String tag,
java.lang.String message) |
void |
log(java.lang.String tag,
java.lang.String message,
java.lang.Throwable exception) |
protected void |
onActivityResult(int requestCode,
int resultCode,
Intent data) |
void |
onConfigurationChanged(Configuration config) |
protected void |
onDestroy() |
protected void |
onPause() |
protected void |
onResume() |
void |
onWindowFocusChanged(boolean hasFocus) |
void |
postRunnable(java.lang.Runnable runnable) |
void |
removeAndroidEventListener(AndroidEventListener listener)
Removes an event listener for Android specific event such as onActivityResult(...).
|
void |
removeLifecycleListener(LifecycleListener listener) |
void |
setApplicationLogger(ApplicationLogger applicationLogger) |
void |
setLogLevel(int logLevel) |
void |
useImmersiveMode(boolean use) |
protected AndroidGraphics graphics
protected AndroidInput input
protected AndroidAudio audio
protected AndroidFiles files
protected AndroidNet net
protected AndroidClipboard clipboard
protected ApplicationListener listener
public Handler handler
protected boolean firstResume
protected final Array<java.lang.Runnable> runnables
protected final Array<java.lang.Runnable> executedRunnables
protected final SnapshotArray<LifecycleListener> lifecycleListeners
protected int logLevel
protected ApplicationLogger applicationLogger
protected boolean useImmersiveMode
protected boolean hideStatusBar
public void initialize(ApplicationListener listener)
Activity#onCreate(Bundle)
method. It sets up all the things necessary to get
input, render via OpenGL and so on. Uses a default AndroidApplicationConfiguration
.listener
- the ApplicationListener
implementing the program logicpublic void initialize(ApplicationListener listener, AndroidApplicationConfiguration config)
Activity#onCreate(Bundle)
method. It sets up all the things necessary to get
input, render via OpenGL and so on. You can configure other aspects of the application with the rest of the fields in the
AndroidApplicationConfiguration
instance.listener
- the ApplicationListener
implementing the program logicconfig
- the AndroidApplicationConfiguration
, defining various settings of the application (use accelerometer,
etc.).public View initializeForView(ApplicationListener listener)
Activity#onCreate(Bundle)
method. It sets up all the things necessary to get
input, render via OpenGL and so on. Uses a default AndroidApplicationConfiguration
.
Note: you have to add the returned view to your layout!
listener
- the ApplicationListener
implementing the program logicpublic View initializeForView(ApplicationListener listener, AndroidApplicationConfiguration config)
Activity#onCreate(Bundle)
method. It sets up all the things necessary to get
input, 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!
listener
- the ApplicationListener
implementing the program logicconfig
- the AndroidApplicationConfiguration
, defining various settings of the application (use accelerometer,
etc.).protected FrameLayout.LayoutParams createLayoutParams()
protected void createWakeLock(boolean use)
protected void hideStatusBar(boolean hide)
public void onWindowFocusChanged(boolean hasFocus)
public void useImmersiveMode(boolean use)
protected void onPause()
protected void onResume()
protected void onDestroy()
public ApplicationListener getApplicationListener()
public Audio getAudio()
public AndroidInput getInput()
public Files getFiles()
public Graphics getGraphics()
public Net getNet()
public ApplicationType getType()
public int getVersion()
public long getJavaHeap()
public long getNativeHeap()
public Preferences getPreferences(java.lang.String name)
public Clipboard getClipboard()
public void postRunnable(java.lang.Runnable runnable)
public void onConfigurationChanged(Configuration config)
public void exit()
public void debug(java.lang.String tag, java.lang.String message)
public void debug(java.lang.String tag, java.lang.String message, java.lang.Throwable exception)
public void log(java.lang.String tag, java.lang.String message)
public void log(java.lang.String tag, java.lang.String message, java.lang.Throwable exception)
public void error(java.lang.String tag, java.lang.String message)
public void error(java.lang.String tag, java.lang.String message, java.lang.Throwable exception)
public void setLogLevel(int logLevel)
public int getLogLevel()
public void setApplicationLogger(ApplicationLogger applicationLogger)
public ApplicationLogger getApplicationLogger()
public void addLifecycleListener(LifecycleListener listener)
public void removeLifecycleListener(LifecycleListener listener)
protected void onActivityResult(int requestCode, int resultCode, Intent data)
public void addAndroidEventListener(AndroidEventListener listener)
public void removeAndroidEventListener(AndroidEventListener listener)
public Context getContext()
public Array<java.lang.Runnable> getRunnables()
public Array<java.lang.Runnable> getExecutedRunnables()
public SnapshotArray<LifecycleListener> getLifecycleListeners()
public Window getApplicationWindow()
public Handler getHandler()
public AndroidAudio createAudio(Context context, AndroidApplicationConfiguration config)
public AndroidInput createInput(Application activity, Context context, java.lang.Object view, AndroidApplicationConfiguration config)