Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

7. Android Widgets > Creating a Collection Widget

Creating a Collection Widget

Android 3.0 introduced a new type of widget that can display a collection of data provided by a remote data source such as a ContentProvider. The widget itself displays this data in a list, grid, stack, or picture frame. Creating one of these widgets is exactly like creating a standard widget but requires a new RemoteViewsService and RemoteViewsFactory to supply the collection data.

Creating the Layout

The layout for a collection widget should contain a collection view, as well as a TextView that displays when the collection is empty. The collection view can be one of the following:

ListView. A vertically scrolling list of items.

GridView. A vertically scrolling grid of items.

StackView. A stack of cards the user can flip through.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial