Sony Addon SDK

Added in API level 1

public class

SmallApplication

This project is no longer being supported and will not get any further updates.
extends android.content.ContextWrapper
  1. java.lang.Object
  2. android.content.ContextWrapper
  3. com.sony.smallapp.SmallApplication

Class Overview

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.

State diagram for a SmallApplication Lifecycle.

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.

Summary

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.

Public Constructors

Added in API level 1 public SmallApplication()

Public Methods

Added in API level 1 public android.view.View findViewById(int id)

Find a view that was identified by the ID attribute from the XML that was processed in onCreate().

Parameters
id Resource ID for desired view.
Returns

The view if found otherwise null.

Added in API level 1 public void finish()

Call this when your Small App is done and should be closed.

Added in API level 2 public android.content.Intent getIntent()

Retrieve the intent that started this Small App.

Note that this method needs to be called after onStart().

Returns

The intent that started this Small App.

Added in API level 1 public SmallAppWindow getWindow()

Retrieve the current SmallAppWindow for the Small App.

Added in API level 1 public void setContentView(int layoutResID)

Set the Small App content from a layout resource. The resource will be inflated, adding all top-level views to the Small App.

Parameters
layoutResID Resource ID to be inflated.

Added in API level 1 public void setContentView(android.view.View view)

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.

Parameters
view The desired content to display

Added in API level 1 public void setMinimizedView(int layoutResID)

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.

Parameters
layoutResID The layout id of the extra content

Added in API level 1 public void setMinimizedView(android.view.View view)

Set the Small App content to show when the Small App is minimized. By default, the application icon is shown in minimized view.

Parameters
view The extra content to show when minimized.

Added in API level 1 public void setTitle(java.lang.CharSequence title)

Change the title associated with this Small App.

Parameters
title Title.

Added in API level 1 public void setTitle(int titleResID)

Change the title associated with this Small App.

Parameters
titleResID Resource ID for desired title.

Protected Methods

Added in API level 1 protected void onCreate()

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.

Added in API level 1 protected void onDestroy()

Perform any final cleanup before a Small App is destroyed.

Derived classes must call through to the super class's implementation of this method.

Added in API level 1 protected boolean onSmallAppConfigurationChanged(android.content.res.Configuration newConfig)

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.

Parameters
newConfig The new device configuration.
Returns

Return true if the the Small App should not restart. If false, the Small App will restart.

See Also

Added in API level 1 protected void onStart()

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.

Added in API level 1 protected void onStop()

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.