IT. Expert System.

Android Reference

AppWidgetManager


android.appwidget

Class AppWidgetManager



  • public class AppWidgetManager
    extends Object
    Updates AppWidget state; gets information about installed AppWidget providers and other AppWidget related state.

    Developer Guides

    For more information about creating app widgets, read the App Widgets developer guide.

    • Method Detail

      • updateAppWidget

        public void updateAppWidget(int[] appWidgetIds,
                           RemoteViews views)
        Set the RemoteViews to use for the specified appWidgetIds. Note that the RemoteViews parameter will be cached by the AppWidgetService, and hence should contain a complete representation of the widget. For performing partial widget updates, see partiallyUpdateAppWidget(int[], RemoteViews).

        It is okay to call this method both inside an ACTION_APPWIDGET_UPDATE broadcast, and outside of the handler. This method will only work when called from the uid that owns the AppWidget provider.

        The total Bitmap memory used by the RemoteViews object cannot exceed that required to fill the screen 1.5 times, ie. (screen width x screen height x 4 x 1.5) bytes.

        Parameters:
        appWidgetIds - The AppWidget instances for which to set the RemoteViews.
        views - The RemoteViews object to show.
      • updateAppWidgetOptions

        public void updateAppWidgetOptions(int appWidgetId,
                                  Bundle options)
        Update the extras for a given widget instance. The extras can be used to embed additional information about this widget to be accessed by the associated widget's AppWidgetProvider.
        Parameters:
        appWidgetId - The AppWidget instances for which to set the RemoteViews.
        options - The options to associate with this widget
        See Also:
        getAppWidgetOptions(int)
      • getAppWidgetOptions

        public Bundle getAppWidgetOptions(int appWidgetId)
        Get the extras associated with a given widget instance. The extras can be used to embed additional information about this widget to be accessed by the associated widget's AppWidgetProvider.
        Parameters:
        appWidgetId - The AppWidget instances for which to set the RemoteViews.
        Returns:
        The options associated with the given widget instance.
        See Also:
        updateAppWidgetOptions(int, Bundle)
      • updateAppWidget

        public void updateAppWidget(int appWidgetId,
                           RemoteViews views)
        Set the RemoteViews to use for the specified appWidgetId. Note that the RemoteViews parameter will be cached by the AppWidgetService, and hence should contain a complete representation of the widget. For performing partial widget updates, see partiallyUpdateAppWidget(int, RemoteViews).

        It is okay to call this method both inside an ACTION_APPWIDGET_UPDATE broadcast, and outside of the handler. This method will only work when called from the uid that owns the AppWidget provider.

        The total Bitmap memory used by the RemoteViews object cannot exceed that required to fill the screen 1.5 times, ie. (screen width x screen height x 4 x 1.5) bytes.

        Parameters:
        appWidgetId - The AppWidget instance for which to set the RemoteViews.
        views - The RemoteViews object to show.
      • partiallyUpdateAppWidget

        public void partiallyUpdateAppWidget(int[] appWidgetIds,
                                    RemoteViews views)
        Perform an incremental update or command on the widget(s) specified by appWidgetIds. This update differs from updateAppWidget(int[], RemoteViews) in that the RemoteViews object which is passed is understood to be an incomplete representation of the widget, and hence does not replace the cached representation of the widget. As of API level 17, the new properties set within the views objects will be appended to the cached representation of the widget, and hence will persist. Use with RemoteViews.showNext(int), RemoteViews.showPrevious(int), RemoteViews.setScrollPosition(int, int) and similar commands.

        It is okay to call this method both inside an ACTION_APPWIDGET_UPDATE broadcast, and outside of the handler. This method will only work when called from the uid that owns the AppWidget provider.

        This method will be ignored if a widget has not received a full update via updateAppWidget(int[], RemoteViews).

        Parameters:
        appWidgetIds - The AppWidget instances for which to set the RemoteViews.
        views - The RemoteViews object containing the incremental update / command.
      • partiallyUpdateAppWidget

        public void partiallyUpdateAppWidget(int appWidgetId,
                                    RemoteViews views)
        Perform an incremental update or command on the widget specified by appWidgetId. This update differs from updateAppWidget(int, RemoteViews) in that the RemoteViews object which is passed is understood to be an incomplete representation of the widget, and hence is not cached by the AppWidgetService. Note that because these updates are not cached, any state that they modify that is not restored by restoreInstanceState will not persist in the case that the widgets are restored using the cached version in AppWidgetService. Use with RemoteViews.showNext(int), RemoteViews.showPrevious(int), RemoteViews.setScrollPosition(int, int) and similar commands.

        It is okay to call this method both inside an ACTION_APPWIDGET_UPDATE broadcast, and outside of the handler. This method will only work when called from the uid that owns the AppWidget provider.

        This method will be ignored if a widget has not received a full update via updateAppWidget(int[], RemoteViews).

        Parameters:
        appWidgetId - The AppWidget instance for which to set the RemoteViews.
        views - The RemoteViews object containing the incremental update / command.
      • updateAppWidget

        public void updateAppWidget(ComponentName provider,
                           RemoteViews views)
        Set the RemoteViews to use for all AppWidget instances for the supplied AppWidget provider.

        It is okay to call this method both inside an ACTION_APPWIDGET_UPDATE broadcast, and outside of the handler. This method will only work when called from the uid that owns the AppWidget provider.

        Parameters:
        provider - The ComponentName for the BroadcastReceiver provider for your AppWidget.
        views - The RemoteViews object to show.
      • notifyAppWidgetViewDataChanged

        public void notifyAppWidgetViewDataChanged(int[] appWidgetIds,
                                          int viewId)
        Notifies the specified collection view in all the specified AppWidget instances to invalidate their currently data.
        Parameters:
        appWidgetIds - The AppWidget instances for which to notify of view data changes.
        viewId - The collection view id.
      • notifyAppWidgetViewDataChanged

        public void notifyAppWidgetViewDataChanged(int appWidgetId,
                                          int viewId)
        Notifies the specified collection view in all the specified AppWidget instance to invalidate it's currently data.
        Parameters:
        appWidgetId - The AppWidget instance for which to notify of view data changes.
        viewId - The collection view id.
      • getInstalledProviders

        public List<AppWidgetProviderInfo> getInstalledProviders()
        Return a list of the AppWidget providers that are currently installed.
      • getAppWidgetInfo

        public AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId)
        Get the available info about the AppWidget.
        Returns:
        A appWidgetId. If the appWidgetId has not been bound to a provider yet, or you don't have access to that appWidgetId, null is returned.
      • bindAppWidgetId

        public void bindAppWidgetId(int appWidgetId,
                           ComponentName provider)
        Set the component for a given appWidgetId.

        You need the BIND_APPWIDGET permission or the user must have enabled binding widgets always for your component. This method is used by the AppWidget picker and should not be used by other apps.

        Parameters:
        appWidgetId - The AppWidget instance for which to set the RemoteViews.
        provider - The BroadcastReceiver that will be the AppWidget provider for this AppWidget.
      • bindAppWidgetId

        public void bindAppWidgetId(int appWidgetId,
                           ComponentName provider,
                           Bundle options)
        Set the component for a given appWidgetId.

        You need the BIND_APPWIDGET permission or the user must have enabled binding widgets always for your component. This method is used by the AppWidget picker and should not be used by other apps.

        Parameters:
        appWidgetId - The AppWidget instance for which to set the RemoteViews.
        provider - The BroadcastReceiver that will be the AppWidget provider for this AppWidget.
        options - Bundle containing options for the AppWidget. See also updateAppWidgetOptions(int, Bundle)
      • bindAppWidgetIdIfAllowed

        public boolean bindAppWidgetIdIfAllowed(int appWidgetId,
                                       ComponentName provider)
        Set the component for a given appWidgetId.

        You need the BIND_APPWIDGET permission or the user must have enabled binding widgets always for your component. Should be used by apps that host widgets; if this method returns false, call ACTION_APPWIDGET_BIND to request permission to bind

        Parameters:
        appWidgetId - The AppWidget instance for which to set the RemoteViews.
        provider - The BroadcastReceiver that will be the AppWidget provider for this AppWidget.
        Returns:
        true if this component has permission to bind the AppWidget
      • bindAppWidgetIdIfAllowed

        public boolean bindAppWidgetIdIfAllowed(int appWidgetId,
                                       ComponentName provider,
                                       Bundle options)
        Set the component for a given appWidgetId.

        You need the BIND_APPWIDGET permission or the user must have enabled binding widgets always for your component. Should be used by apps that host widgets; if this method returns false, call ACTION_APPWIDGET_BIND to request permission to bind

        Parameters:
        appWidgetId - The AppWidget instance for which to set the RemoteViews.
        provider - The BroadcastReceiver that will be the AppWidget provider for this AppWidget.
        options - Bundle containing options for the AppWidget. See also updateAppWidgetOptions(int, Bundle)
        Returns:
        true if this component has permission to bind the AppWidget
      • hasBindAppWidgetPermission

        public boolean hasBindAppWidgetPermission(String packageName)
        Query if a given package was granted permission by the user to bind app widgets

        You need the MODIFY_APPWIDGET_BIND_PERMISSIONS permission

        Parameters:
        packageName - The package for which the permission is being queried
        Returns:
        true if the package was granted permission by the user to bind app widgets
      • setBindAppWidgetPermission

        public void setBindAppWidgetPermission(String packageName,
                                      boolean permission)
        Changes any user-granted permission for the given package to bind app widgets

        You need the MODIFY_APPWIDGET_BIND_PERMISSIONS permission

        Parameters:
        provider - The package whose permission is being changed
        permission - Whether to give the package permission to bind widgets
      • bindRemoteViewsService

        public void bindRemoteViewsService(int appWidgetId,
                                  Intent intent,
                                  IBinder connection)
        Binds the RemoteViewsService for a given appWidgetId and intent. The appWidgetId specified must already be bound to the calling AppWidgetHost via AppWidgetManager.bindAppWidgetId().
        Parameters:
        appWidgetId - The AppWidget instance for which to bind the RemoteViewsService.
        intent - The intent of the service which will be providing the data to the RemoteViewsAdapter.
        connection - The callback interface to be notified when a connection is made or lost.
      • unbindRemoteViewsService

        public void unbindRemoteViewsService(int appWidgetId,
                                    Intent intent)
        Unbinds the RemoteViewsService for a given appWidgetId and intent. The appWidgetId specified muse already be bound to the calling AppWidgetHost via AppWidgetManager.bindAppWidgetId().
        Parameters:
        appWidgetId - The AppWidget instance for which to bind the RemoteViewsService.
        intent - The intent of the service which will be providing the data to the RemoteViewsAdapter.
      • getAppWidgetIds

        public int[] getAppWidgetIds(ComponentName provider)
        Get the list of appWidgetIds that have been bound to the given AppWidget provider.
        Parameters:
        provider - The BroadcastReceiver that is the AppWidget provider to find appWidgetIds for.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1654 / 96487453. Delta: 0.04674 с