O'Reilly logo

Pro Android 4 by Satya Komatineni, Dave MacLean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required