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

How to do it...

To fully demonstrate working Fragments, we'll need to create two Fragments. The first Fragment will extend from ListFragment so it will not need a layout. We're going to go one step further by creating both portrait and landscape layouts for our Activity. For portrait mode, we'll swap Fragments and for landscape mode, we'll show both Fragments side by side.

When typing this code, Android Studio will offer two different library import options. Since the New Project Wizard automatically references the AppCompat library, we need to use the support library APIs instead of the framework APIs. Though very similar, the following code uses the support Fragment APIs.

Here are the steps, starting with the first Fragment:

  1. Create a new ...
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