O'Reilly logo

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

Learning Android Application Development

Book Description

Build Android N applications using modern techniques and libraries to get your own high-quality apps published on Google Play in no time

About This Book

  • Get started with Android development, from the installation of required tools to publishing to the market
  • Get started with Android development, from the installation of required tools to publishing to the market
  • Save time and improve the quality of your applications with widely used open source libraries and dependency management

Who This Book Is For

Want to get started with Android development? Start here.

What You Will Learn

  • Get to know how to use popular open source libraries to reduce time to market and avoid re-inventing the wheel
  • Automate your application’s testing phase to avoid last minute crashes
  • Use dependency management to properly keep dependencies and updates under control
  • Efficiently show huge amounts of items in a list
  • Forget about memory and speed concerns
  • Publish and monetize your Android applications on Google Play
  • Persist your application data so it can continue working in offline mode
  • Don’t let the UX break because of network issues

In Detail

The mobile app market is huge. But where do you start? And how you can deliver something that takes Google Play by storm? This guide is the perfect route into Android app development – while it’s easy for new apps to sink without a trace, we’ll give you the best chance of success with practical and actionable guidance that will unlock your creativity and help you put the principles of Android development into practice.

From the fundamentals and getting your project started to publishing your app to a huge market of potential customers, follow this guide to become a confident, creative and reliable mobile developer. Get to grips with new components in Android 7 such as RecyclerView, and find out how to take advantage of automated testing, and, of course, much, much more.

What are you waiting for? There’s never been a better time – or a better way – to get into Android app development.

Style and approach

More than just a manual, this is an accessible route into Android development. Packed with examples that demonstrate how to put key concepts and ideas into practice, this guide isn’t just about learning, it’s about immediate development.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Learning Android Application Development
    1. Learning Android Application Development
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    7. 1. Getting Started with Android Development
      1. Setting up Android Studio
        1. Getting the right version of Android Studio
        2. Installing Android Studio
        3. First run
      2. Creating a sample project
        1. Starting a new project
        2. Running your project
        3. Resource configuration qualifiers
      3. Additional elements
        1. Resources
        2. Modules
        3. Android Manifest
        4. Gradle build system
        5. ProGuard
      4. Summary
    8. 2. Activities and Fragments - The Backbone of Your App
      1. Activities
        1. Android design guidelines
        2. The Activity context and scope
        3. Activity lifecycle
          1. Activity states
          2. Activity lifecycle callbacks
          3. Activity states and callbacks
          4. The activity stack
      2. Creating activities
        1. Defining your activity
          1. Editing the app manifest
          2. Creating our Activity class
          3. Building the sample application
            1. Setting up your device for debugging
            2. Running the application
      3. Fragments
        1. When to use fragments
        2. Fragment lifecycle
          1. Fragment context
          2. Activity - fragment lifecycles
          3. Fragment lifecycle callbacks
      4. Creating fragments
        1. Creating our own fragment
        2. Creating a static fragment constructor
          1. Using values from the static factory implementation
        3. Adding a fragment to an activity
          1. Running the application
        4. Adding multiple fragments to a single activity
          1. Adding multiple fragments to an activity
            1. Adding two fragments in a single FragmentTransaction
            2. Running the application
      5. Navigating through an app
        1. Activity navigation
      6. Summary
    9. 3. Working with Views – Interacting with Your App
      1. Views and ViewGroups
        1. Common views
          1. TextView
            1. Common operations
          2. EditText
            1. Common operations
          3. ImageView
            1. Common operations
          4. Button
            1. Common operations
          5. ImageButton
            1. Common operations
          6. Switch and CheckBox
            1. Common operations
          7. WebView
            1. Common operations
        2. Common ViewGroups
          1. FrameLayout
            1. Common operations
          2. CardView
            1. Common operations
          3. LinearLayout
            1. Common operations
          4. RelativeLayout
            1. Common operations
          5. ScrollView
            1. Common operations
          6. ListView
            1. Common operations
          7. GridView
            1. Common operations
          8. RecyclerView
            1. Common operations
          9. ConstraintLayout
            1. Common operations
      2. Building a user interface using views and ViewGroups
        1. Creating interfaces using layout files
          1. Creating a basic layout
            1. Adding a TextView
            2. Previewing the layout
            3. Using your layout file
            4. Styling the TextView
            5. Testing the layout
        2. Creating user interfaces programmatically
      3. Creating custom views
        1. The first custom view example
          1. Custom drawing
            1. Drawing on a Canvas
          2. Hooking up the CustomView
            1. Adding the custom view programmatically
            2. Adding the custom view using a layout file
            3. Testing the CustomView
        2. The second custom view example
          1. Creating the CustomTextView class
          2. Adding on-click behavior
          3. Testing the CustomTextView
          4. Overriding the onTouchEvent method
      4. Additional user interface components
        1. Toasts
        2. Dialogs
      5. Summary
    10. 4. Lists and Adapters
      1. ListView and ListActivity
        1. ListView
        2. ListActivity
        3. Customizing the item view
      2. Adapters
        1. ArrayAdapter
        2. Performance considerations
        3. BaseAdapter
      3. RecyclerView
        1. Replacing ListView with RecyclerView
        2. CardView
        3. ItemAnimator
        4. ItemDecoration
        5. StaggeredGridLayoutManager
      4. Summary
    11. 5. Remote Data
      1. Permissions
        1. Android M permission mechanism
        2. Permission groups
      2. Background processing
        1. Java threads
        2. AsyncTask
        3. IntentService
      3. Network code
        1. Android standard libraries
        2. Volley
        3. Gson
        4. Retrofit
        5. Real case scenario
      4. Summary
    12. 6. Image Management
      1. Caching remote data
        1. Memory caches
        2. Disk caches
        3. Handling configuration changes
      2. Loading images
        1. Memory
        2. Handling large images
        3. Different image types
        4. Vector drawables
        5. Images in a RecyclerView
      3. Widely used third-party libraries
        1. Glide
        2. UIL
        3. Picasso
        4. Fresco
      4. Summary
    13. 7. Permanent Data
      1. Storing preferences
        1. Initialization
        2. Basic use
        3. Additional features
      2. Files
        1. Internal storage
        2. External storage
        3. Additional methods
      3. SQLite
        1. Schema and contract definition
        2. Helper implementation
      4. Third-party libraries
        1. Realm
      5. Summary
    14. 8. Testing Your Application
      1. Testing logic
        1. Simple calculator application
        2. Unit tests
        3. Discovering and fixing issues by creating tests
        4. Instrumentation tests
        5. Testing integrations
        6. Mocking Android dependencies
      2. Testing the UI
        1. Setup
        2. Creating UI tests
        3. Simplifying UI test creation
      3. Putting it all together
      4. Summary
    15. 9. Publishing Your Application
      1. Preparation steps
        1. Application signing
        2. Account creation
      2. Publishing your application on Google Play
        1. Adding a new application
        2. Preparing the Store Listing
        3. Uploading the application APK
      3. Summary
    16. 10. Monetization – Make Money with Your App
      1. Paid apps
        1. Creating a paid app
        2. Finance tracking
      2. In-app purchases
        1. Initial setup
        2. Adding in-app products
        3. Application code setup
        4. Purchasing in-app products from our application
        5. Consuming purchases
      3. In-app advertising
        1. Integrating with the Google Mobile Ads SDK
      4. Summary