Class Lifecycle
java.lang.Object
com.codename1.system.Lifecycle
Optional helper class that implements the Codename One lifecycle methods with reasonable default
implementations to help keep sample code smaller.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCallback that can be overriden to disable or modify crash protectionvoiddestroy()Callback when the app is destroyedprotected FormThe current form within the application lifecycle which possibly differs from the one in the implementationprotected intReturns the default number of network thread countgetTheme()The theme instanceprotected StringReturns the name of the global theme file, by default it's "/theme".protected voidInvoked on a network error callbackvoidInvoked when the app is "cold launched", this acts like a constructorvoidrunApp()This method is invoked by start to show the first form of the applicationprotected voidsetCurrentForm(Form current) The current form within the application lifecycle which possibly differs from the one in the implementationvoidstart()Default start callback that's invoked on application resumevoidstop()Callback when the app is suspended
-
Constructor Details
-
Lifecycle
public Lifecycle()
-
-
Method Details
-
init
Invoked when the app is "cold launched", this acts like a constructor
Parameters
context: some OSs might pass a native object representing platform internal information
-
bindCrashProtection
protected void bindCrashProtection()Callback that can be overriden to disable or modify crash protection -
getNetworkThreadCount
protected int getNetworkThreadCount()Returns the default number of network thread count
Returns
currently two threads
-
getThemeName
Returns the name of the global theme file, by default it's "/theme". Can be overriden by subclasses to load a different file name
Returns
"/theme"
-
getTheme
The theme instance
Returns
the theme
-
handleNetworkError
Invoked on a network error callback
Parameters
err: the network error event
-
start
public void start()Default start callback that's invoked on application resume -
runApp
public void runApp()This method is invoked by start to show the first form of the application -
stop
public void stop()Callback when the app is suspended -
destroy
public void destroy()Callback when the app is destroyed -
getCurrentForm
The current form within the application lifecycle which possibly differs from the one in the implementation -
setCurrentForm
The current form within the application lifecycle which possibly differs from the one in the implementation
Parameters
current: the new current Form
-