Book Image

Android 9 Development Cookbook - Third Edition

By : Rick Boyer
Book Image

Android 9 Development Cookbook - Third Edition

By: Rick Boyer

Overview of this book

The Android OS has the largest installation base of any operating system in the world. There has never been a better time to learn Android development to write your own applications, or to make your own contributions to the open source community! With this extensively updated cookbook, you'll find solutions for working with the user interfaces, multitouch gestures, location awareness, web services, and device features such as the phone, camera, and accelerometer. You also get useful steps on packaging your app for the Android Market. Each recipe provides a clear solution and sample code you can use in your project from the outset. Whether you are writing your first app or your hundredth, this is a book that you will come back to time and time again, with its many tips and tricks on the rich features of Android Pie.
Table of Contents (24 chapters)
Title Page
Copyright and Credits
Dedication
About Packt
Contributors
Preface
Index

Introduction


Since most applications, big or small, require saving data – from default user selections to user accounts – Android offers many options. From saving a simple value to creating full databases using SQLite, storage options include the following:

  • Shared preferences: Simple name/value pairs
  • Internal storage: Data files in private storage
  • External storage: Data files in private or public storage
  • SQLite database: Private data (can be made public through a Content Provider)
  • Cloud storage: Private server or service provider

There are benefits and trade-offs to using internal and external storage. We will list some of the differences here to help you decide which option best fits your needs:

Internal storage:

  • Unlike external storage, internal storage is always available but generally has less free space
  • Files are not accessible to the user (unless the device has root access)
  • Files are automatically deleted when your app is uninstalled (or with the Clear Cache/Cleanup File option in the App Manager...