public class AppWidgetHost extends Object
Constructor and Description |
---|
AppWidgetHost(Context context,
int hostId) |
AppWidgetHost(Context context,
int hostId,
RemoteViews.OnClickHandler handler,
Looper looper) |
Modifier and Type | Method and Description |
---|---|
int |
allocateAppWidgetId()
Get a appWidgetId for a host in the calling process.
|
protected void |
clearViews()
Clear the list of Views that have been created by this AppWidgetHost.
|
AppWidgetHostView |
createView(Context context,
int appWidgetId,
AppWidgetProviderInfo appWidget)
Create the AppWidgetHostView for the given widget.
|
static void |
deleteAllHosts()
Remove all records about all hosts for your package.
|
void |
deleteAppWidgetId(int appWidgetId)
Stop listening to changes for this AppWidget.
|
void |
deleteHost()
Remove all records about this host from the AppWidget manager.
|
int[] |
getAppWidgetIds()
Gets a list of all the appWidgetIds that are bound to the current host
|
protected AppWidgetHostView |
onCreateView(Context context,
int appWidgetId,
AppWidgetProviderInfo appWidget)
Called to create the AppWidgetHostView.
|
protected void |
onProviderChanged(int appWidgetId,
AppWidgetProviderInfo appWidget)
Called when the AppWidget provider for a AppWidget has been upgraded to a new apk.
|
protected void |
onProvidersChanged()
Called when the set of available widgets changes (ie. widget containing packages
are added, updated or removed, or widget components are enabled or disabled.)
|
void |
startAppWidgetConfigureActivityForResult(Activity activity,
int appWidgetId,
int intentFlags,
int requestCode,
Bundle options)
Starts an app widget provider configure activity for result on behalf of the caller.
|
void |
startListening()
Start receiving onAppWidgetChanged calls for your AppWidgets.
|
void |
stopListening()
Stop receiving onAppWidgetChanged calls for your AppWidgets.
|
public AppWidgetHost(Context context, int hostId)
public AppWidgetHost(Context context, int hostId, RemoteViews.OnClickHandler handler, Looper looper)
public void startListening()
public void stopListening()
public int allocateAppWidgetId()
public final void startAppWidgetConfigureActivityForResult(Activity activity, int appWidgetId, int intentFlags, int requestCode, Bundle options)
Activity.onActivityResult(int, int, android.content.Intent)
and
an options bundle to be passed to the started activity.
Note that the provided app widget has to be bound for this method to work.
activity
- The activity from which to start the configure one.appWidgetId
- The bound app widget whose provider's config activity to start.requestCode
- Optional request code retuned with the result.intentFlags
- Optional intent flags.ActivityNotFoundException
- If the activity is not found.AppWidgetProviderInfo.getProfile()
public int[] getAppWidgetIds()
public void deleteAppWidgetId(int appWidgetId)
public void deleteHost()
public static void deleteAllHosts()
public final AppWidgetHostView createView(Context context, int appWidgetId, AppWidgetProviderInfo appWidget)
protected AppWidgetHostView onCreateView(Context context, int appWidgetId, AppWidgetProviderInfo appWidget)
protected void onProviderChanged(int appWidgetId, AppWidgetProviderInfo appWidget)
protected void onProvidersChanged()
protected void clearViews()