public class

AppWidgetHostView

extends FrameLayout
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.appwidget.AppWidgetHostView

Class Overview

Provides the glue to show AppWidget views. This class offers automatic animation between updates, and will try recycling old views for each incoming RemoteViews.

Summary

[Expand]
Inherited XML Attributes
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
Public Constructors
AppWidgetHostView(Context context)
Create a host view.
AppWidgetHostView(Context context, int animationIn, int animationOut)
Create a host view.
Public Methods
int getAppWidgetId()
AppWidgetProviderInfo getAppWidgetInfo()
void setAppWidget(int appWidgetId, AppWidgetProviderInfo info)
Set the AppWidget that will be displayed by this view.
void updateAppWidget(RemoteViews remoteViews)
Process a set of RemoteViews coming in as an update from the AppWidget provider.
Protected Methods
boolean drawChild(Canvas canvas, View child, long drawingTime)
Draw one child of this View Group.
View getDefaultView()
Inflate and return the default layout requested by AppWidget provider.
View getErrorView()
Inflate and return a view that represents an error state.
void prepareView(View view)
Prepare the given view to be shown.
[Expand]
Inherited Methods
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent

Public Constructors

public AppWidgetHostView (Context context)

Create a host view. Uses default fade animations.

public AppWidgetHostView (Context context, int animationIn, int animationOut)

Create a host view. Uses specified animations when pushing updateAppWidget(RemoteViews).

Parameters
animationIn Resource ID of in animation to use
animationOut Resource ID of out animation to use

Public Methods

public int getAppWidgetId ()

public AppWidgetProviderInfo getAppWidgetInfo ()

public void setAppWidget (int appWidgetId, AppWidgetProviderInfo info)

Set the AppWidget that will be displayed by this view.

public void updateAppWidget (RemoteViews remoteViews)

Process a set of RemoteViews coming in as an update from the AppWidget provider. Will animate into these new views as needed.

Protected Methods

protected boolean drawChild (Canvas canvas, View child, long drawingTime)

Draw one child of this View Group. This method is responsible for getting the canvas in the right state. This includes clipping, translating so that the child's scrolled origin is at 0, 0, and applying any animation transformations.

Parameters
canvas The canvas on which to draw the child
child Who to draw
drawingTime The time at which draw is occuring
Returns
  • True if an invalidate() was issued

protected View getDefaultView ()

Inflate and return the default layout requested by AppWidget provider.

protected View getErrorView ()

Inflate and return a view that represents an error state.

protected void prepareView (View view)

Prepare the given view to be shown. This might include adjusting FrameLayout.LayoutParams before inserting.