|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectandroid.content.ContextWrapper
com.sony.smallapp.SmallApplication
public class SmallApplication
SmallApplication class is the base class to implement each Small App.
SmallApplication class has similar API and similar lifecycle with Activity.
Each SmallApplication classes have SmallAppWindow to interact with the user and
you can use #setContentView(int) to place your UI on SmallAppWIndow.
All SmallApplication classes must have a corresponding <service>
declaration in their package's AndroidManifest.xml.
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.
You must declare your Small App in the manifest file in order for it to be
accessible to the system.
To declare your Small App, open your manifest file and add an <service>
element as a child of the <application> element.
<service> element must have the attribute
android:exported="true".
In addition this, you must add <uses-permission> element
and <uses-library> element
to use Small Apps feature.
Here is an example:
<manifest ...>
...
<uses-permission android:name="com.sony.smallapp.permission.SMALLAPP" />
...
<application ...>
...
<uses-library android:name="com.sony.smallapp.framework" />
...
<service android:exported="true">
<intent-filter>
<action android:name="com.sony.smallapp.intent.action.MAIN" />
<category android:name="com.sony.smallapp.intent.category.LAUNCHER" />
</intent-filter>
</service>
...
</manifest>
In <service> element, you must declare intent-filter like an example
above.
<action> element is mandatory but you can drop <category>
element if your application
should not be listed on Small Apps launcher.
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(Configuration) method.
| Constructor Summary | |
|---|---|
SmallApplication()
|
|
| Method Summary | |
|---|---|
android.view.View |
findViewById(int id)
Finds 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. |
SmallAppWindow |
getWindow()
Retrieve the current SmallAppWindow for the Small App. |
protected void |
onCreate()
Called when the Small App is starting. |
protected void |
onDestroy()
Perform any final cleanup before a Small App is destroyed. |
protected boolean |
onSmallAppConfigurationChanged(android.content.res.Configuration newConfig)
Called when the device configuration changes while your Small App is running. |
protected void |
onStart()
Called after onCreate(). |
protected void |
onStop()
Called when the Small App is no longer visible to the user. |
void |
setContentView(android.view.View view)
Set the Small App content to an explicit view. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SmallApplication()
| Method Detail |
|---|
protected void onCreate()
#setContentView(int)
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.
protected void onDestroy()
Derived classes must call through to the super class's implementation of this method.
public void setContentView(android.view.View view)
view - The desired content to displaypublic void setMinimizedView(android.view.View view)
view - The extra content to show when minimized.public android.view.View findViewById(int id)
id - Resource ID for desired view.
public void setTitle(java.lang.CharSequence title)
title - Title.public void setTitle(int titleResID)
titleResID - Resource ID for desired title.protected void onStop()
Derived classes must call through to the super class's implementation of this method.
protected void onStart()
Derived classes must call through to the super class's implementation of this method.
public SmallAppWindow getWindow()
protected boolean onSmallAppConfigurationChanged(android.content.res.Configuration newConfig)
newConfig - The new device configuration.
android.app.Service#onConfigurationChanged(android.content.res.Configuration)public void finish()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||