Android Design Patterns and Best Practice
eBook - ePub

Android Design Patterns and Best Practice

Kyle Mew

Share book
  1. 370 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Android Design Patterns and Best Practice

Kyle Mew

Book details
Book preview
Table of contents
Citations

About This Book

Create reliable, robust, and efficient Android apps with industry-standard design patterns

About This Book

  • Create efficient object interaction patterns for faster and more efficient Android development
  • Get into efficient and fast app development and start making money from your android apps
  • Implement industry-standard design patterns and best practices to reduce your app development time drastically

Who This Book Is For

This book is intended for Android developers who have some basic android development experience. Basic Java programming knowledge is a must to get the most out of this book.

What You Will Learn

  • Build a simple app and run it on real and emulated devices
  • Explore the WYSIWYG and XML approaches to material design provided within Android Studio
  • Detect user activities by using touch screen listeners, gesture detection, and reading sensors
  • Apply transitions and shared elements to employ elegant animations and efficiently use the minimal screen space of mobile devices
  • Develop apps that automatically apply the best layouts for different devices by using designated directories
  • Socialize in the digital word by connecting your app to social media
  • Make your apps available to the largest possible audience with the AppCompat support library

In Detail

Are you an Android developer with some experience under your belt? Are you wondering how the experts create efficient and good-looking apps? Then your wait will end with this book! We will teach you about different Android development patterns that will enable you to write clean code and make your app stand out from the crowd.

The book starts by introducing the Android development environment and exploring the support libraries. You will gradually explore the different design and layout patterns and get to know the best practices of how to use them together. Then you'll then develop an application that will help you grasp activities, services, and broadcasts and their roles in Android development.

Moving on, you will add user-detecting classes and APIs such as gesture detection, touch screen listeners, and sensors to your app. You will also learn to adapt your app to run on tablets and other devices and platforms, including Android Wear, auto, and TV. Finally, you will see how to connect your app to social media and explore deployment patterns as well as the best publishing and monetizing practices.

The book will start by introducing the Android development environment and exploring the support libraries. You will gradually explore the different Design and layout patterns and learn the best practices on how to use them together. You will then develop an application that will help you grasp Activities, Services and Broadcasts and their roles in Android development. Moving on, you will add user detecting classes and APIs such as at gesture detection, touch screen listeners and sensors to our app. You will also learn to adapt your app to run on tablets and other devices and platforms, including Android Wear, Auto, and TV. Finally, you will learn to connect your app to social media and explore deployment patterns and best publishing and monetizing practices.

Style and approach

This book takes a step-by-step approach. The steps are explained using real-world practical examples. Each chapter uses case studies where we show you how using design patterns will help in your development process.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Android Design Patterns and Best Practice an online PDF/ePUB?
Yes, you can access Android Design Patterns and Best Practice by Kyle Mew in PDF and/or ePUB format, as well as other popular books in Informatik & Open-Source-Programmierung. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781786467218

Android Design Patterns and Best Practice


Android Design Patterns and Best Practice

Copyright Š 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2016
Production reference: 1201216
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78646-721-8
www.packtpub.com

Credits

Author
Kyle Mew
Copy Editor
Safis Editing
Reviewer
VĂ­ctor Albertos
Project Coordinator
Devanshi Doshi
Commissioning Editor
Amarabha Banerjee
Proofreader
Safis Editing
Acquisition Editor
Shweta Pant
Indexer
Mariammal Chettiyar
Content Development Editor
Narendrakumar Tripathi
Graphics
Jason Monteiro
Technical Editor
Anushree Arun Tendulkar
Production Coordinator
Shantanu N. Zagade

About the Author

Kyle Mew has been programming since the early eighties and has written for several technology websites. He has also written three radio plays and three other books on Android development.

About the Reviewer

Victor Albertos has been developing Android apps for 5 years. During this time, he had the chance to explore several approaches to achieve maintainable and testable code. From an imperative style, gradually he has switch to a more declarative one, applying concepts and theories from functional languages such as Haskell to the Android and Java ecosystem.
He is an active open source contributor, sharing with the Android community useful libraries, mainly focused on reactive programming.
Currently he is working as an Android architect at Sabadell Bank.
I would like to thank to my family for their constant support, my few friends for being always there, and specially to Inma, who I deeply love.

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
www.PacktPub.com
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.

Why subscribe?

  • Fully searchable across every book published by Packt
  • Copy and paste, print, and bookmark content
  • On demand and accessible via a web browser

Customer Feedback

Thank you for purchasing this Packt book. We take our commitment to improving our content and products to meet your needs seriously—that's why your feedback is so valuable. Whatever your feelings about your purchase, please consider leaving a review on this book's Amazon page. Not only will this help us, more importantly it will also help others in the community to make an informed decision about the resources that they invest in to learn.
You can also review for us on a regular basis by joining our reviewers' club. If you're interested in joining, or would like to learn more about the benefits we offer, please contact us: [email protected]

Preface

Welcome to Android Design Patterns and Best Practice, a comprehensive guide to how to get the most out of your apps with the tried and tested programming philosophy, design patterns. These patterns provide a logical and elegant approach to solving many of the development problems that coders face. These patterns act as a guide creating a clear path from problem to solution, and although applying a design pattern does not guarantee best practice in itself, it will hugely assist the process and make the discovery of design flaws far easier. Design patterns can be implemented on very many platforms and written in as many programming languages. Some code libraries even apply patterns as part of their internal mechanics, and many readers will already be familiar with the Java Observer and Observable classes. The Android SDK we will be exploring makes great use of many patterns, such as factories, builders and listeners (which are really just observer patterns). Although we will cover these built-in design patterns, the book will mostly explore how we can build our own, custom made, patterns and apply them to Android development. Rather than approach each design pattern in turn, this book approaches the subject from the perspective of a developer, moving through each aspect of app development exploring individual design patterns as they would arise in the course of building an Android app. To clarify this journey, we will be focusing on a single imaginary app, designed to support a small business. This will take us from application conception through to publication, covering such topics as UI design, internal logic and user interaction along the way. During each of these steps we will explore those design patterns that are relevant to that process, by first exploring the pattern in its abstract form and then applying it to that particular situation. By the end of the book you will have learned how design patterns can be applied to all aspects of Android development and how using them assists best practice. It is the concept of design patterns that is more important than any specific pattern itself. Patterns can, and should, be adapted to suit our specific purposes, and by learning this way of approaching app development, we can even go on to create entirely original patterns of our own.

What this book covers

Chapter 1, Design Patterns, introduces the development environment, and two common design patterns, the factory and abstract factory.
Chapter 2, Creational Patterns, covers material and interface design, exploring the design support library and the builder design pattern.
Chapter 3, Material Patterns, introduces Android User Interfaces and some of the most significant material design components such as the app bar and sliding navigation drawer. This will introduce menus and action icons and how to implement them and how to use a drawer listener to detect user activity.
Chapter 4, Layout Patterns, leads in from the previous one, delving further into Android Layout design patterns and how gravity and weight can be used to create layouts that work on a variety of devices. This will take us onto how Android handles device orientation and screen size and shape differences. The strategy pattern is introduced and demonstrated.
Chapter 5, Structural Patterns, delves us deeper into the design library and create a layout governed by a coordinator layout with a recycler view. This requires exploring the adapter design pattern, first the internal versions and then we build one of our own, as well as a bridge pattern and facade and filter patterns.
Chapter 6, Activating Patterns, shows us how to apply patterns directly to our app. We cover more design library features such as collapsing toolbars, scrolling and divider. We crate a custom dialog, triggered by user activity. We revisit the factory patterns and show how a builder pattern can be used to inflate a UI.
Chapter 7, Combining Patterns, introduces and demonstrates two new structural patterns the prototype and decorator, covering their flexibility. This is then put in to practice as we use the patterns to control a UI comprised of different compound buttons such as switches and radio groups.
Chapter 8, Composing Patterns, concentrates on the composite pattern and how it can be used in many situations and how to select the right situation. We then continue to use it in a practical demonstration to inflate ...

Table of contents