Added in API level 1
Public Constructors | |
---|---|
SmallApplication() |
Public Methods | |
---|---|
android.view.View |
findViewById(int id)
Find a view that was identified by the ID attribute from the XML that was processed in onCreate(). |
void |
finish()
Call this when your Small App is done and should be closed. |
android.content.Intent |
getIntent()
Retrieve the intent that started this Small App. |
SmallAppWindow |
getWindow()
Retrieve the current SmallAppWindow for the Small App. |
void |
setContentView(int layoutResID)
Set the Small App content from a layout resource. |
void |
setContentView(android.view.View view)
Set the Small App content to an explicit view. |
void |
setMinimizedView(int layoutResID)
Set the Small App content to show when the Small App is minimized from a layout resource. |
void |
setMinimizedView(android.view.View view)
Set the Small App content to show when the Small App is minimized. |
void |
setTitle(java.lang.CharSequence title)
Change the title associated with this Small App. |
void |
setTitle(int titleResID)
Change the title associated with this Small App. |
Protected Methods | |
---|---|
void |
onCreate()
Called when the Small App is starting. |
void |
onDestroy()
Perform any final cleanup before a Small App is destroyed. |
boolean |
onSmallAppConfigurationChanged(android.content.res.Configuration newConfig)
Called when the device configuration changes while your Small App is running. |
void |
onStart()
Called after onCreate(). |
void |
onStop()
Called when the Small App is no longer visible to the user. |
Find a view that was identified by the ID attribute from the XML that was processed in onCreate().
id | Resource ID for desired view. |
---|
The view if found otherwise null.
Call this when your Small App is done and should be closed.
Retrieve the intent that started this Small App.
Note that this method needs to be called after onStart().
The intent that started this Small App.
Retrieve the current SmallAppWindow for the Small App.
Set the Small App content from a layout resource. The resource will be inflated, adding all top-level views to the Small App.
layoutResID | Resource ID to be inflated. |
---|
Set the Small App content to an explicit view. This view is placed directly into the Small App's view hierarchy. It can itself be a complex view hierarchy.
view | The desired content to display |
---|
Set the Small App content to show when the Small App is minimized from a layout resource. By default application icon is shown in minimized view.
layoutResID | The layout id of the extra content |
---|
Set the Small App content to show when the Small App is minimized. By default, the application icon is shown in minimized view.
view | The extra content to show when minimized. |
---|
Change the title associated with this Small App.
title | Title. |
---|
Change the title associated with this Small App.
titleResID | Resource ID for desired title. |
---|
Called when the Small App is starting. This is where most initialization should go: calling setContentView(android.view.View) to inflate the Small App's UI, using findViewById(int) to programmatically interact with widgets in the UI, etc.
Derived classes must call through to the super class's implementation of this method.
Perform any final cleanup before a Small App is destroyed.
Derived classes must call through to the super class's implementation of this method.
Called when the device configuration changes while your Small App is running. The returned boolean value determines whether or not the Small App will restart.
newConfig | The new device configuration. |
---|
Return true if the the Small App should not restart. If false, the Small App will restart.
Called after onCreate(). The Small App is now being displayed to the user. The counterpart to onStop().
Derived classes must call through to the super class's implementation of this method.
Called when the Small App is no longer visible to the user. The counterpart to onStart().
Derived classes must call through to the super class's implementation of this method.
The SmallApplication class is the base class to implement each Small App. The SmallApplication class has a similar interface and similar lifecycle with the Activity class. Each SmallApplication class has a SmallAppWindow to interact with users. You can use setContentView(android.view.View) to place your UI on a SmallAppWindow.
All SmallApplication classes must have a corresponding <service> declaration in their package's
AndroidManifest.xml
.SmallApplication Lifecycle
The following diagram shows the important state paths of a SmallApplication.
All SmallApplication classes must have a corresponding <service> declaration in their package's
AndroidManifest.xml
. See here for more detail information.Configuration Changes
If the configuration of the device (as defined by the Resources.Configuration class) changes, the Small App will restart because everything in the user interface will need to be updated to match this configuration. In order to handle the configuration change, you can override onSmallAppConfigurationChanged(android.content.res.Configuration) method.