Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Mastering Android Application Development
Mastering Android Application Development

Mastering Android Application Development: Learn how to do more with the Android SDK with this advanced Android Application guide which shows you how to make even better Android apps that users will love

eBook
$9.99 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Mastering Android Application Development

Chapter 2. Designing our App

In this chapter, we will think of an idea for an app and transform that idea into a real app, create a basic structure to be displayed on the screen, and choose an appropriate navigation pattern to move between them.

After taking a look at the most commonly used navigation pattern, we will proceed with implementing the tabs pattern composed by fragment and ViewPager.

During this, we will do a review of our knowledge of fragments to be able to explain the advanced concepts. We will also discuss the importance of FragmentManager and the fragments back-stack.

To finish, we will add some good-looking animations to our screen transitions. Therefore, we will cover the following topics in this chapter:

  • Selecting an app navigation pattern
  • Mastering fragments
  • Implementing tabs and ViewPager
  • Animated transitions between screens

Selecting an app-navigation pattern

Let's imagine that one day you wake up feeling inspired; you have an idea for an app that you believe can become more popular than WhatsApp. Without losing time, you would want to turn this app idea into reality! This is why it's important for you to learn how to design an app and choose the most appropriate navigation pattern. Not to sound uninspiring, but you'll find that 99 percent of your ideas will already be on Google Play Store. It's simply a fact that there are hundreds of thousands of apps available, and the number is always increasing! So, you can either decide to improve upon the already existing ones or keep brainstorming until you have something original.

In order to make the app a reality, the first step is to visualize the app in your mind; for this, we need to identify the basic components. We need to simplify the idea on screen, and we need to move between screens.

Bear in mind that you are creating this app for Android...

Fragments

In this section, we are going to review briefly the key concepts of fragments to explain advanced features and components, such as Fragment Manager and the fragments back stack.

In our example, we will create an activity called MainActivity and four fragments: ListFragment, ContactFragment, SettingsFragment, and DetailsFragment. For this, you can create a fragments package and double-click on the package to go to New | Fragment | Blank Fragment. Take a look at the following dialog box:

Fragments

For now, you can create them without the fragment factory methods and the interface callbacks. We will cover these later in the chapter.

Our project so far should look like this in the Project view:

Fragments

Understanding the importance of fragments

A fragment represents a behavior or a portion of the user interface in an activity. You can combine multiple fragments in a single activity to build a multipane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section of an...

ViewPager

Continuing with our example, we have two ways of navigating between fragments on MainActivity: either by tapping on the tabs or by swiping between the fragments. To achieve this, we will use ViewPager, including the sliding tabs inside it, which is a very elegant solution with minimal code and includes synchronization between swipe and tabs.

ViewPager can be used to slide any kind of view. We could create a gallery of images with ViewPager; it is very common to see tutorials in the first run of some apps where you can slide the screen with instructions on how the app works, and this is achieved with ViewPager. To add ViewPager to MainActivity, we can simply copy and paste the following code:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent...

Transitions

Small details such as creating our own animations from the screen transitions will polish our app and really make it look more professional.

Our example is perfect to talk about transitions as we have two types of screen transitions:

  • The first one is a transition between Activities, from SplashActivity to MainActivity
  • The second one (not implemented yet) is a transition between fragments, where ListFragment is replaced with DetailsFragment

For the transitions between activities, we need to call overridePendingTransition just before starting the new activity. The method receives two animations as parameters, and these animations can be in an XML file created by us or be chosen from the already created animations in Android. Run the following command:

overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);

In our example, we don't allow back navigation to SplashActivity; however, if we were in a transition between activities where we wanted to have the same...

Summary

At the end of this chapter, you should have an understanding of the basic navigation patterns and be able to translate the idea of an app in your mind into the real structure of an Android app. Fragments are a key concept in Android development, and we have spent enough time in this chapter mastering them with a review of Fragment Manager and the fragments back stack and by learning how to face common problems such as communication between them. We considered a working example of ViewPager with PagerTabStrip showing the tile of the pages as tabs, which you now know how to customize if needed. We have a skeleton of an app; this project can be saved at this stage and used as a template for your future developments. We are ready to continue evolving our app.

In the next chapter, we will see how to create and access the content that will populate our fragments and ViewPager to bring our app to life.

Left arrow icon Right arrow icon

Key benefits

  • 1. Learn how to design and build better Android apps to reach new users
  • 2. Explore the latest features and tools in the Android SDK that will help you become a better developer
  • 3. From concurrency to testing – through to adding adverts and billing, this book ties together every element to help you deliver a high-quality Android application on Google Play

Description

There are millions of Android apps out there for people to download – how do you make sure yours has the edge? It’s not always about innovation and ideas – the most successful apps are those that are able to satisfy customer demands – they’re the ones that look the best, the fastest, and the easiest and most intuitive to use. This book shows you how to create Android applications that do precisely that – it has been designed help you consider and answer those questions throughout the development process, so you can create applications that stand out against the crowd. Learn how to create exemplary UIs that contribute to a satisfying user experience through the lens of Material Design, and explore how to harness the range of features within the Android SDK to help you. Dive deeper into complex programming concepts and discover how to leverage concurrency and navigate memory management and image handling. You’ll also find further guidance on testing and debugging so you can guarantee that your application is reliable and robust for users. Beyond this you’ll find out how to extend your app and add greater functionality, including notifications, location services, adverts and app billing (essential if you want to properly monetize your creation!). To make sure you have confidence at every stage in the process, the book also shows you how to release your app to the Play store – to make sure your maximising your efforts to create a popular Android application!

Who is this book for?

Mastering Android Application Development is intended for Android developers that want insight on and guidance through the steps they need to take to give their creations the edge in a competitive market.

What you will learn

  • • Create an Android project with Android M features
  • • Design the basic navigation for our app using the UI components
  • • Set up a cloud-based platform and store data on it
  • • Implement programming patterns such as Singleton and Observer to maintain your project code for future use
  • • Display lists and grids using Android RecyclerView
  • • Implement user interface components and make your app look professional
  • • Handle, download, and store images along with memory management
  • • Create the database and content providers to perform read-write operations
  • • Add notifications to the app and analytics to track the user's usage
  • • Show a Google map view on your app
  • • Configure minify to obfuscate the code
  • • Add adverts and create products for purchase in your app

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 30, 2015
Length: 298 pages
Edition : 1st
Language : English
ISBN-13 : 9781785887628
Vendor :
Google
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Oct 30, 2015
Length: 298 pages
Edition : 1st
Language : English
ISBN-13 : 9781785887628
Vendor :
Google
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 147.97
Android Programming for Beginners
$54.99
Android Studio Cookbook
$43.99
Mastering Android Application Development
$48.99
Total $ 147.97 Stars icon
Banner background image

Table of Contents

13 Chapters
1. Getting Started Chevron down icon Chevron up icon
2. Designing our App Chevron down icon Chevron up icon
3. Creating and Accessing Content from the Cloud Chevron down icon Chevron up icon
4. Concurrency and Software Design Patterns Chevron down icon Chevron up icon
5. Lists and Grids Chevron down icon Chevron up icon
6. CardView and Material Design Chevron down icon Chevron up icon
7. Image Handling and Memory Management Chevron down icon Chevron up icon
8. Databases and Loaders Chevron down icon Chevron up icon
9. Push Notifications and Analytics Chevron down icon Chevron up icon
10. Location Services Chevron down icon Chevron up icon
11. Debugging and Testing on Android Chevron down icon Chevron up icon
12. Monetization, the Build Process, and Release Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(1 Ratings)
5 star 0%
4 star 0%
3 star 100%
2 star 0%
1 star 0%
G. Bohrn Sep 25, 2016
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
This is overall a decent book. the problem I have with it is it relies upon Parse which no longer exists online so the cloud based connection code just will not work. It would be nice if the author fixed this with an addendum connecting to a different cloud server or setting up Parse locally. Otherwise this would work well
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.