Working Sample: Test Home Screen List Widget

This home screen list widget sample will demonstrate the ideas covered thus far about list-based home screen widgets. At the end of this sample, you will see a list-based widget that you can drag onto the home screen. When you drag it, you will see a widget displaying 20 rows of list items filled with sample text. When you click one of these list item rows, you will see a Toast on the home screen containing text from that specific row of the list.

Here is the list of files you will need:

  • TestListWidgetProvider.java is the primary class; it’s the test widget provider that implements a widget with a list view as one of its views (Listing 26–21).
  • TestRemoteViewsFactory.java is the class that provides ...

Get Pro Android 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.