Skip to Main Content
Android 9 Development Cookbook - Third Edition
book

Android 9 Development Cookbook - Third Edition

by Rick Boyer
October 2018
Intermediate to advanced content levelIntermediate to advanced
464 pages
15h 17m
English
Packt Publishing
Content preview from Android 9 Development Cookbook - Third Edition

Creating a Home screen widget

Before we dig into the code for creating an App Widget, let's cover the basics. There are three required and one optional component:

  • The AppWidgetProviderInfo file: It's an XML resource (described later)
  • The AppWidgetProvider class: This is a Java class
  • The View layout file: It's a standard layout XML file, with some restrictions (explained later)
  • The App Widget configuration Activity (optional): This is an Activity the OS will launch when placing the widget to provide configuration options

The AppWidgetProvider must also be declared in the AndroidManifest file. Since AppWidgetProvider is a helper class based on the Broadcast Receiver, it is declared in the manifest with the <receiver> element. Here is an example ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Android Application Development Cookbook - Second Edition

Android Application Development Cookbook - Second Edition

Rick Boyer, Kyle Mew
Android Things Projects

Android Things Projects

Francesco Azzola
Android High Performance Programming

Android High Performance Programming

Enrique López Mañas, Diego Grancini

Publisher Resources

ISBN: 9781788991216Supplemental Content